创建测试用表:
CREATE OR REPLACE VIEW v AS
SELECT 'A1' AS c FROM DUAL
UNION ALL
SELECT '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;
执行结果如下:
创建测试用表:
CREATE OR REPLACE VIEW v AS
SELECT 'A1' AS c FROM DUAL
UNION ALL
SELECT '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