| |
GeekInterview.com > Interview Questions > Oracle > SQL
| Print | |
| Question: What is difference between SUBSTR and INSTR?
Answer:
SUBSTR returns a specified portion of a string eg SUBSTR('BCDEF',4) output BCDE INSTR provides character position in which a pattern is found in a string. eg INSTR('ABC-DC-F','-',2) output 7 (2nd occurence of '-') |
| June 06, 2008 03:22:02 |
#7 |
| ashish88 |
Member Since: June 2008 Total Comments: 6 |
RE: What is difference between SUBSTR and INSTR? |
hi Buddy,
Substr only give the sub part of the string Substr(String,'start postion','length') Substr('ABCDEFAG',3,7); /*out put is =cdefag */
Instr to give only possion of letter in use in a string Instr(String,'letter',possition of letter in use) Instr('ABCDEFAB','a',1,2)/* out put is= 1 |
| |
Back To Question | |