Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to search a string in reverse order using REGEXP_INSTR

BurasamiSep 30 2010 — edited Sep 30 2010
Hi All,

I have SQL query in which i wants to get the first occurrence position from end of the string

eg:
String:NBANK-ASD-00-1001-525-1002
Condition: position of character '-' from last. (note: character may also be '-' or '/')
output: 1002

for above condition i have return following query


SELECT SUBSTR('NBANK-ASD-00-1001-525-1002',REGEXP_INSTR('NBANK-ASD-00-1001-525-1002','[^-/]',1),LENGTH('NBANK-ASD-00-1001-525-1002')) FROM dual;



but i am getting following result

NBANK-ASD-00-1001-525-1002
means that the expression returns 0..

pls help me to resolve this.
This post has been answered by BobLilly on Sep 30 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 28 2010
Added on Sep 30 2010
8 comments
7,215 views