Insert XML with more than 4000 characters into a Oracle XMLTYPE column

13,035

Check the Oracle docs about XMLType

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

Share:
13,035
Marco
Author by

Marco

Updated on June 05, 2022

Comments

  • Marco
    Marco almost 2 years

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

    (Short version):

    PROCEDURE InsertXML 
    (
         pXMLData IN LONG 
    )
    IS
    BEGIN
    
        INSERT INTO MY_TABLE (XML_DATA) VALUES(pXMLData);
    
    END InsertXML;
    

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

    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
    

    How can I handle this? Thx 4 answers

  • Marco
    Marco about 14 years
    Thx, "CLOB" type was the answer :) /closed
  • Pratik Rawlekar
    Pratik Rawlekar almost 5 years
    How can I convert xml string for more than 4000 charcaters into SQLXML type first?
  • Pratik Rawlekar
    Pratik Rawlekar almost 5 years
    @Marco How did you fixed this? Can you please post your solution?