将超过 4000 个字符的 XML 插入 Oracle XMLTYPE 列

2022-01-09 00:00:00 xml insert oracle ora-01461 ora-20000

我有一个 oracle 表,其中有一列来自SYS.XMLTYPE"类型的列和一个正在执行插入操作的存储过程:

I have an oracle table with a column from type "SYS.XMLTYPE" and a storage procudure which is doing the insert:

(短版):

PROCEDURE InsertXML 
(
     pXMLData IN LONG 
)
IS
BEGIN

    INSERT INTO MY_TABLE (XML_DATA) VALUES(pXMLData);

END InsertXML;

我从我的 C# 代码中调用这个 sp,类型为OracleType.LongVarChar".

I call this sp from my C# code with type "OracleType.LongVarChar".

现在的问题:如果 xml 的字符少于 4000 个,一切正常,但使用超过 4000 个字符的 xml 会出现以下错误:

Now the problem: If the xml has less than 4000 characters everything is working fine, but by using a xml with more than 4000 characters I get the following error:

ORA-20000: ORA-01461: can bind a LONG value only for insert into a LONG column

我该如何处理?谢谢 4 个答案

How can I handle this? Thx 4 answers

推荐答案

查看Oracle docs about XMLType

Check the Oracle docs about XMLType

另外,我认为数据类型应该是 CLOB(字符大对象).

Also, I believe the datatype should be a CLOB (Character Large Object).

相关文章