oracle30004,oracle - Oracle ORA-30004在使用SYS_CONNECT_BY_PATH函数时, - 堆栈内存溢出

那是因为--是的一部分-->分离器而不是一部分->分离。

即使您的数据值具有-->此查询也不应出错。 像下面。

SQL> select Sys_Connect_By_Path('SomeText B-->More Text' || ':' || 'SomeText A-->More Text', ' --> ') "myNewVar"

from dual

connect by rownum<=3;

myNewVar

----------------------------------------------------

--> SomeText B-->More Text:SomeText A-->More Text

--> SomeText B-->More Text:SomeText A-->More Text --> SomeText B-->More Text:SomeText A-->More Text

--> SomeText B-->More Text:SomeText A-->More Text --> SomeText B-->More Text:SomeText A-->More Text --> SomeText B-->More Text:SomeText A-->More Text

上面的分隔符是--> ,请注意空格。 该空白被视为分隔符的一部分,即chr(1)||chr(45)||chr(45)||chr(62)||chr(1) 。 整个字符串不属于您的数据或列值。

哪里会出现以下错误

SQL> select Sys_Connect_By_Path('SomeText B-->More Text' || ':' || 'SomeText A-->More Text', '-->') "myNewVar"

from dual

connect by rownum<=3;

ORA-30004: when using SYS_CONNECT_BY_PATH function, cannot have seperator as part of column value

30004. 00000 - "when using SYS_CONNECT_BY_PATH function, cannot have seperator as part of column value"

*Cause:

*Action: Use another seperator which does not occur in any column value,

then retry.

上面的分隔符是--> ,请注意没有空格,即chr(45)||chr(45)||chr(62) 。 整个字符串确实是您的数据或列值的一部分,因此是错误。

这是一个解决方案(性能未经测试)

select regexp_replace(Sys_Connect_By_Path('SomeText B-->More Text' || ':' || 'SomeText A-->More Text', ' -> '),' -> ','-->') "myNewVar"

from dual

connect by rownum<=3;

myNewVar

--------------------------------------

-->SomeText B-->More Text:SomeText A-->More Text

-->SomeText B-->More Text:SomeText A-->More Text-->SomeText B-->More Text:SomeText A-->More Text

-->SomeText B-->More Text:SomeText A-->More Text-->SomeText B-->More Text:SomeText A-->More Text-->SomeText B-->More Text:SomeText A-->More Text

说明-这里(在上面的查询中) -> (带空格)不是此处数据的一部分,即--> 。 一旦列由路径conected的regexp_replace替换出现的所有->与-->所以这样你仍然可以拥有-->为您的分隔符,而不是-> 。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值