SQL错误:ORA-01704 - 字符串文字太长 [英] SQL Error: ORA-01704 - string literal too long

查看:2533
本文介绍了SQL错误:ORA-01704 - 字符串文字太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个表,其中一个字段用于保存长JSON格式数据。我将CLOB定义为字段数据类型。当我运行INSERT脚本时,我得到了

I created a table, in which one of the fields is to be used to hold a long JSON format data. I defined CLOB as the field data type. When I run an INSERT script, I got

SQL Error: ORA-01704: string literal too long
01704. 00000 -  "string literal too long"
*Cause:    The string literal is longer than 4000 characters.<pre lang="SQL">



我该怎么办?将字段重新定义为BIGTEXT(32767个字符)?谢谢,如果你能提供帮助。


How can I re-define the field as BIGTEXT (in 32767 characters)? Thanks if you can help.

推荐答案

要修改列类型,请使用更改表格 [ ^ ]



但我怀疑这条消息来自CLOB专栏,因为它可以存储多达128个字节 - 参考 [ ^ ]



限制4000更有可能是 VARCHAR2 列(参见上面的相同参考资料)



我从来没有听说过Oracle中BIGTEXT的数据类型(但是我用它已经有一段时间了)



编辑 - 回应你的评论...你在定义CLOB时没有给出一个大小 - 它是一个预定义的大小。使用此
To modify the column type use Alter Table[^]

But I doubt that message is coming from the CLOB column as it can store up to 128 terrabytes - reference[^]

A limit of 4000 is more likely to be an VARCHAR2 column (see same reference above)

I've never heard of a datatype of BIGTEXT in Oracle (but it's been a while since I used it)

EDIT - in response to your comment ... you do not give a size when defining a CLOB - it is a pre-defined size. Use this
ALTER TABLE myTbl  MODIFY S_LINE CLOB;

您的其他尝试失败,因为varchar2不能超过4000个字符...因为您的原始错误消息告诉您

Your other attempt failed because a varchar2 cannot be more than 4000 characters ... as your original error message told you


这篇关于SQL错误:ORA-01704 - 字符串文字太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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