| |
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 '-') |
| August 08, 2007 07:08:00 |
#6 |
| syam sundar |
Member Since: Visitor Total Comments: N/A |
RE: What is difference between SUBSTR and INSTR?... |
substr: sub(string,n,m): It returns the characters from nth position, m
characters long Ex:-substr(abcdefgh,3,3) it returns cde instr:
instr(string,n,m):It returns the position of the nth character of the mth
occurrence. Ex:-instr(abcadea,1,3) it returns 7 |
| |
Back To Question | |