I need to extract the first integer number found in a column of a database. Unfortunately, I am stuck using data from an Oracle 9i database, which doesn't support regex.
Some data examples:
'Count 1,2,3...' should return '1'
'3.1415 is pi' should return '3'
'I saw 11 Olds 442s today' should return '11'
'Part number 12,345' should return '12'
'Order 5 100 piece kits' should return '5'
'ABcdEFg' should return ''
I cannot figure out how to extract these numbers from these strings using Oracle 9i.
In Oracle 10g+ I could use REGEXP_SUBSTR(my_data, '([0-9]+)'), like so:
SELECT name, REGEXP(address, '([0-9]+)') as street_num FROM people;
How can I accomplish this?
Oh well. The simplest "solution" is to upgrade, if possible.
Otherwise, see if such a function helps.
Testing: