创建测试用表:
CREATE OR REPLACE VIEW v ASSELECT 'A1' AS c FROM DUALUNION ALLSELECT '12B' AS c FROM DUAL;SELECT * FROM v;
SQL代码如下:
SELECT REGEXP_REPLACE(c, '[0-9]', '') AS c1, REGEXP_REPLACE(c, '[^0-9]', '') AS c2 FROM v;
执行结果如下:
本文共 286 字,大约阅读时间需要 1 分钟。
创建测试用表:
CREATE OR REPLACE VIEW v ASSELECT 'A1' AS c FROM DUALUNION ALLSELECT '12B' AS c FROM DUAL;SELECT * FROM v;
SQL代码如下:
SELECT REGEXP_REPLACE(c, '[0-9]', '') AS c1, REGEXP_REPLACE(c, '[^0-9]', '') AS c2 FROM v;
执行结果如下:
转载于:https://www.cnblogs.com/minisculestep/p/4892336.html