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 are the new features in Oracle 10g. Compared to Oracle 9i?

1 Answers   Polaris,


How do I run a program in pl sql?

0 Answers  


How can you tell the difference between an index and a view?

0 Answers  


What is referential integrity ?

3 Answers   BirlaSoft,


what is unique key constraint? : Sql dba

0 Answers  






what is difference between stored procedures and application procedures,stored function and application function?

1 Answers  


what is the difernece between named and anonymous pl/sql blocks??

8 Answers   TCS, Wells Fargo,


How can triggers be used for the table auditing?

0 Answers  


What are the events on which a database trigger can be based?

0 Answers  


What are keys in sql?

0 Answers  


What are different types of tables in sql?

0 Answers  


Delete the emps whose salaries are lowest sals of their own dept.

5 Answers  


Categories