Link to home
Start Free TrialLog in
Avatar of Scarlett72
Scarlett72

asked on

Capture data between 2 characters

Hi I need to parse the content between the first and second '-' in a string, ie  012-09324-5418567  (Oracle 10g)
The following does work for me; however, I was also wondering if there is a more efficient way to do this or how to do it using regexp_instr:
 
SELECT SUBSTR('012-09324-541',INSTR('012-09324-541', '-')+1, INSTR('012-09324-541', '-' ,1,2)-INSTR('012-09324-541', '-')-1) FROM DUAL;

Open in new window


Result:  09324
 
Thank you in advance for suggestions.
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial