本文介绍了"PLS-00172:字符串文字太长"将大字符串值设置为 CLOB 时抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含 CLOB 字段的存储过程.当我使用大值(超过 33K 个字符)调用存储过程时,出现错误PLS-00172:字符串文字太长"
I have a stored procedure which has a CLOB field. When i invoke the stored procedure with a large value (over 33K characters) I get the error "PLS-00172: string literal too long"
我的存储过程
create or replace procedure P(c clob) is
begin
dbms_output.put_line('dbms_lob.getlength(c)');
end;
调用存储过程
declare
C CLOB := 'large text over 33k characters';
begin
P(C => C);
end;
/
问题:
PLS-00172:字符串文字太长";调用存储过程时抛出错误
推荐答案
''是一个 varchar2-Literal,然后会自动转换为 CLOB.要将大型文字转换为 clob,您可以将其拆分为不同的部分,然后将它们连接起来:
'<Text>' is a varchar2-Literal that then is automatically converted to CLOB. To Convert a large literal to clob you can split it to different part and then concat them:
declare
c clob := TO_CLOB('First 32k characters')||TO_CLOB('Second 32k characters')||...;
begin
P(C => C);
end;
/
这篇关于&quot;PLS-00172:字符串文字太长"将大字符串值设置为 CLOB 时抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!