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 the difference between SQL table and the PLSQL table?
Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints
How much ram can sql express use?
Explain the uses of a database trigger?
What is union and union all keyword in sql and what are their differences?
what is the sql query to display current date? : Sql dba
What does “select count(*) from tab” result?
15 Answers IBM, Student, Wipro,
what is the difference between binary_integer and pls_integer
How do I write a sql query in pgadmin 4?
What is %s in sql?
Is truncate ddl or dml?
Explain how can you save or place your msg in a table?
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)