在oracle查询中使用长字符串(超过4000)

您所在的位置:网站首页 oracle字符串超过4000 在oracle查询中使用长字符串(超过4000)

在oracle查询中使用长字符串(超过4000)

2024-07-10 09:04| 来源: 网络整理| 查看: 265

好吧,这很接近你的实现偏差的边缘,虽然记得forall是一个批量绑定操作,而不是一个真正的循环,但你看过dbms_utility.comma_to_table函数? 它是一个优化的内部oracle解析函数,虽然有一些限制,你可以在这里阅读:http://www.techiegyan.com/2009/02/17/oracle-breaking-comma-separated-string-using-dbms_utilitycomma_to_table/ 您需要使用replace()使其以逗号分隔,如果您已经解析了以数字,特殊字符,逗号等开头的字段,则还需要双引号括起来。 但是如果您的数据允许 - 它确保您的代码看起来更清晰(并且可能也会更快地运行)

declare myvar varchar2(32000) := 'tcd1~#testmsg1^~tcd2~#testmsg2^~tcd3~#testmsg3'; mycnt binary_integer; myresults sys.dbms_utility.lname_array; begin sys.dbms_utility.comma_to_table('"'||replace(myvar,'^~','","')||'"', mycnt, myresults ); delete from t; forall ix in myresults.first..myresults.last insert into tvalues (myresults(ix)); commit; end;


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3