You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用dbms_lob.append向绑定变量追加字符串报错求助

请问这段SQL*Plus代码哪里有问题?

最小复现示例:

var c clob
exec dbms_lob.append(:c, 'test')
print c

执行后出现如下错误:

BEGIN dbms_lob.append(:c, 'test'); END;
Error report -
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 656
ORA-06512: at line 1
06502. 00000 -  "PL/SQL: numeric or value error%s"
*Cause:    An arithmetic, numeric, string, conversion, or constraint error
           occurred. For example, this error occurs if an attempt is made to
           assign the value NULL to a variable declared NOT NULL, or if an
           attempt is made to assign an integer larger than 99 to a variable
           declared NUMBER(2).
*Action:   Change the data, how it is manipulated, or how it is declared so
           that values do not violate constraints.

我查阅了Oracle绑定变量相关文档,其中提到:

执行VARIABLE ... CLOB或NCLOB命令时,SQL*Plus会为绑定变量关联一个LOB定位器。

因此我认为问题并非是变量c未分配LOB定位器。

内容的提问来源于stack exchange,提问作者tearfur

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 21:23:27