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

what is rollback? : Sql dba

0 Answers  


What is the difference between pl and sql?

0 Answers  


What is union and union all keyword in sql and what are their differences?

0 Answers  


what is definer rights invoke rights?

1 Answers  


what are the join types in tsql? : Transact sql

0 Answers  






Why are cursors used?

0 Answers  


What are pl/sql cursor exceptions?

0 Answers  


take one table is t1 and in that column name is f1 f1 column values are 200 5000 3000 7000 300 600 100 400 800 400 i want display the values asc and desc in a single output. sample output is f1.a 100 200 300 400 500 600 etc...... and f1.d is 5000 4000 3000 2000 1000 etc...

9 Answers   Zensar,


How can I tell if sql is running?

0 Answers  


how to enter binary numbers in sql statements? : Sql dba

0 Answers  


Does view contain data?

0 Answers  


How many sql commands are there?

0 Answers  


Categories