Difference between SUBSTR and INSTR?
Answers were Sorted based on User's Feedback
Answer / tulsi
SUBSTR is used to extract a set of characters from a string
by specificing the character starting position and end
position and length of characters to be fetched.
example substr('hello',2,3) will return 'ell'
INSTR is used to find the position of any particular
character in a word which returns numeric value.
instr('hello','e') - will return the position of 'e' as 2
| Is This Answer Correct ? | 65 Yes | 6 No |
Answer / shrikant
Hi,
Yes Tulsi is right.
Execute the below queries & you will see the diff clearly -
SELECT instr('hello','e') FROM dual
SELECT substr('hello',2,3) FROM dual
| Is This Answer Correct ? | 34 Yes | 4 No |
Answer / atchala ramanareddy
substr:
select substr('atchala ramanareddy',2,9) from dual;
it will return tchala ra.
instr:
select instr('atchala ramanareddy','a',1,2) from dual;
it will return 5.
| Is This Answer Correct ? | 19 Yes | 3 No |
what is a database lock ? : Sql dba
What is the use of double ampersand (&&) in sql queries? Give an example
What is bind reference and how can it be created?
What is meant by user defined function?
What is pragma in pl sql?
HOW TO PRINT * ** *** **** ***** BY USING SQL QUERY? (MAY BE USING SCRIPT)
What is the use of pl/sql table?
I have a package in which a table was used in a procedure and compiled later i have dropped the table used in the package what would be the status of package specification and body
What are the types of views in sql?
Which sql statement is used to return only different values?
What is view? Can we update view
Enlist the characteristics of pl/sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)