Difference between SUBSTR and INSTR?

Answers were Sorted based on User's Feedback



Difference between SUBSTR and INSTR?..

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

Difference between SUBSTR and INSTR?..

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

Difference between SUBSTR and INSTR?..

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

Post New Answer

More SQL PLSQL Interview Questions

Determine if oracle date is on a weekend?

0 Answers  


What is the function that is used to transfer a pl/sql table log to a database table?

0 Answers  


Do prepared statements prevent sql injection?

0 Answers  


Do foreign keys improve performance?

0 Answers  


How will you select unique values from a list of records?

7 Answers   Cap Gemini,






Does view store data in sql?

0 Answers  


What is a stored procedure ?

5 Answers  


What do you understand by case manipulation functions?

0 Answers  


How do I order by ascending in sql?

0 Answers  


What is graph sql?

0 Answers  


Who is the owner of mysql database?

0 Answers  


how to analyze tables with 'mysqlcheck'? : Sql dba

0 Answers  


Categories