你的位置:首页 > 数据库

[数据库]将字符和数字数据分离


创建测试用表:

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;

执行结果如下: