REgex to get numeric from string in oracle

梦想与她 提交于 2021-02-05 09:33:28

问题


I have strings in the following formats

Akram_88_jamesstree_20140418, Akram_8_johnstreet_20140418, Akram_888_johnstreet_20140418,

Now I want to retrieve only the 88,8 and 888 value only, for which i have written the following query

SUBSTR(a.file_name, 7, INSTR(a.file_name, '_')-5) as output

now the problem with this query is i just get 88 -8 and 88 of 888.

The output will be compared to another column so i want just 88,8 and 888 numeric values.


回答1:


SELECT REGEXP_SUBSTR('Akram_88_jamesstree','[0-9]+')

Here put your column Name in place of 'Akram_88_jamesstree'.



来源:https://stackoverflow.com/questions/23153080/regex-to-get-numeric-from-string-in-oracle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!