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

There is a table, In one column it has implemented a index, but the index is disturbed by the regular dml statements.. but still we need to keep the index. how it is possible?

1 Answers   Cognizant,


Does view contain data?

0 Answers  


Is sqlite good enough for production?

0 Answers  


cursor types? explain with example programs?

1 Answers   HP,


how can we replace the particular column value of a resulted set of executed query? I mean write down a sql query to chane the particular column's value of a resulted set of executed query

3 Answers  


create a store procedure and created synonms for that store procedure after modify that store procedure will effect on synonms? If we delete the store procedure what happened to that synonms?

2 Answers   Polaris,


In a package if we have 10 procedures or functions,How to know which will execute first?

1 Answers   Sollet Soft,


What are the topics in pl sql?

0 Answers  


what are sequences

0 Answers  


how to use 'mysql' to run sql statements? : Sql dba

0 Answers  


What is the difference between function, procedure and package in pl/sql?

0 Answers  


What is differance unique key and primary key.

7 Answers   EDS,


Categories