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

Explain two virtual tables available at the time of database trigger execution.

1 Answers  


How to start oracle sql developer?

0 Answers  


How to access the current value and next value from a sequence?

6 Answers  


What is error ora-01000: maximum open cursors exceeded

0 Answers  


how to load data files into tables with 'mysqlimport'? : Sql dba

0 Answers  


What is delete command in sql?

0 Answers  


write a query that returns first characters of each word in Oracel/Sql pl sql

5 Answers  


What are the different dcl commands in sql?

0 Answers  


Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no record was found then print "Record Was Not Found".Else Print Deptname And Ename.Dept table Have Dname Varchar2(20),Deptno Number,EnameVarchar2(20).Please Answer In 2 mins,with in Maximum 15 lines.

5 Answers   Wipro,


What are %type and %rowtype for?

0 Answers  


Do we need to create index on primary key?

0 Answers  


Can you upgrade sql express to full sql?

0 Answers  


Categories