"PLS-00172:字符串文字太长"将大字符串值设置为CLOB时引发错误 [英] "PLS-00172: string literal too long" error is thrown while setting large string value to CLOB

查看:164
本文介绍了"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:字符串文字太长"调用存储的proc时抛出错误

"PLS-00172: string literal too long" error is thrown while invoking stored proc

推荐答案

'< Text>'是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;
/

这篇关于"PLS-00172:字符串文字太长"将大字符串值设置为CLOB时引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆