当我试图查询对象时,我得到了以下错误:
ORA-01461: can bind a LONG value only for insert into a LONG column有没有人能帮我解释一下问题的原因和解决方法?
发布于 2012-02-07 01:20:52
好的,既然你没有展示任何代码,我将在这里做一些假设。
根据ORA-1461错误,您似乎已经在select语句中指定了LONG数据类型?你想把它绑定到输出变量上吗?是那么回事吗?错误是非常直接的。只能为insert into LONG列绑定LONG值。
不知道还能说什么。错误是不言而喻的。
通常,从LONG数据类型转移到CLOB是一个好主意。CLOB得到了更好的支持,而长数据类型实际上只是为了向后兼容。
这是一个list of LONG datatype restrictions
希望这能有所帮助。
发布于 2013-01-24 17:24:44
varchar2列也会发生这种情况。通过JDBC使用PreparedStatements,这是非常容易重现的,只需
所以如上所述,它可能是类型错误,或者超出了列宽。
还要注意,由于varchar2允许最多4k个字符,因此双字节字符的实际限制为2k
希望这能有所帮助
发布于 2013-09-18 04:41:48
当用户试图在SQL语句中使用长度超过4000字节的varchar变量时,就会出现此错误。PL/SQL允许varchars最多32767个字节,但数据库表和SQL语言的限制是4000。您不能在SQL语句中使用SQL无法识别的PL/SQL变量;正如该消息所解释的,例外情况是直接插入到long类型的列中。
create table test (v varchar2(10), c clob);
declare
shortStr varchar2(10) := '0123456789';
longStr1 varchar2(10000) := shortStr;
longStr2 varchar2(10000);
begin
for i in 1 .. 10000
loop
longStr2 := longStr2 || 'X';
end loop;
-- The following results in ORA-01461
insert into test(v, c) values(longStr2, longStr2);
-- This is OK; the actual length matters, not the declared one
insert into test(v, c) values(longStr1, longStr1);
-- This works, too (a direct insert into a clob column)
insert into test(v, c) values(shortStr, longStr2);
-- ORA-01461 again: You can't use longStr2 in an SQL function!
insert into test(v, c) values(shortStr, substr(longStr2, 1, 4000));
end;https://stackoverflow.com/questions/9156019
复制相似问题