select regexp_replace('1,2,3,4,10,20,,30,,,40,,,,50 ', '(,){2,}', ',') from dual;
查一下正则表达式,没用过ORACLE的,不过应该差不多
select regexp_replace('1,2,3,4,10,20,,30,,,40,,,,50 ', '(,)+', ',') from dual;
为什么我这边查报错:ORA-00904 :REGEXP_REPLACE 无效的标示符
为什么我这边查报错:ORA-00904 :REGEXP_REPLACE 无效的标示符
你的数据库是什么版本 oracle 9i
select * from v$version
非得10以上的才可以么,公司的是 Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production PL/SQL Release 9.2.0.8.0 - Production CORE 9.2.0.8.0 Production TNS for 32-bit Windows: Version 9.2.0.8.0 - Production NLSRTL Version 9.2.0.8.0 - Production 这不是歇菜了。
select replace(replace('1,2,3,4,10,20,,30,,,40,,,,50',',,,',','),',,',',') from dual 这样好像很笨,从最多连续的逗号串开始嵌套替换
9i好像很落后的感脚! 我们公司10g我都觉得...BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod PL/SQL Release 10.2.0.1.0 - Production CORE 10.2.0.1.0 Production TNS for Linux: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production
from dual;
oracle 9i
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for 32-bit Windows: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
这不是歇菜了。
谢谢了 反正 那个字段中的 逗号 不是太多,一个个弄吧!
这样好像很笨,从最多连续的逗号串开始嵌套替换
我们公司10g我都觉得...BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production