I have a big note column in which there is a word NUMBER_OF_SERVERS_03 the 03 can be any 2 digits or it can have n digits and there is digits after that for example NUMBER_OF_SERVERS_03 2 i want to extract the digits after that for eg
Notes Column - 'asdasd asdasda asdasd NUMBER_OF_SERVERS_03 24 hkashii rwnijt' output will should be 24
Thanks Rakesh
Advertisement
Answer
You need to use REGEXP_SUBSTR
with match parameters as follows:
SQL> SELECT 2 REGEXP_SUBSTR('asdasd asdasda asdasd NUMBER_OF_SERVERS_03 24 hkashii rwnijt', 3 'NUMBER_OF_SERVERS_[0-9]+s+([0-9]+)', 1, 1, NULL, 1) as RESULT 4 FROM 5 DUAL; RE -- 24 -- Example with spaces and different server number SQL> SELECT 2 REGEXP_SUBSTR('asdasd asdasda asdasd NUMBER_OF_SERVERS_11 10 hkashii rwnijt', 3 'NUMBER_OF_SERVERS_[0-9]+s+([0-9]+)', 1, 1, NULL, 1) as RESULT 4 FROM 5 DUAL; RE -- 10 SQL>
Cheers!!