现在的位置: 首页 > 综合 > 正文

oracle正则使用

2013年06月05日 ⁄ 综合 ⁄ 共 341字 ⁄ 字号 评论关闭
问题、讲A010A中的10取出

 

--第一个方式to_number regexp_substr

SQL> select to_number(regexp_substr('A010A','[0-9]+')) from dual;
 
TO_NUMBER(REGEXP_SUBSTR('A010A
------------------------------
                            10
Executed in 0.016 seconds

--第二个方式、regexp_replace

SQL> select regexp_replace('010','^0','') from dual;
 
REGEXP_REPLACE('010','^0','')
-----------------------------
10
Executed in 0.031 seconds

抱歉!评论已关闭.