SQL Language (MOSC)

MOSC Banner

How can I Extract Two Fixed Set Of Numbers From A String?

edited Apr 20, 2016 5:01AM in SQL Language (MOSC) 1 commentAnswered

Hello Team,

I've this issue and I'd be glad if I receive some assistance.

I'm trying to extract the two numbers 0091282525071  and 0091762525079 from the string a string;


TRANSFER FRM 0091282525071 TO 0091762525079 23.09.14


The string could change anytime but I want to be able to extract the two numbers from it whereever their positions might be, ideally with a space between them.

select REGEXP_SUBSTR ('TRANSFER FRM 0091282525071 TO 0091762525079 23.09.14', '[[:digit:]]{13}') from dual;

select REGEXP_SUBSTR ('TRANSFER FRM 0091282525071 TO 0091762525079 23.09.14', '\d{13}+') from dual;

I'm currently only able to extract the first one.

Any form of assistance will be greatly appreciated.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center