string literal too long - how to assign long xml data to clob data type in oracle 11g r2

前端 未结 1 1678
执念已碎
执念已碎 2021-01-16 20:18

I need to assign a very large xml data of around 30,000 lines to a CLOB data type in oracle database 11g r2. I am using this command in Oracle Sql Developer.

When I

相关标签:
1条回答
  • 2021-01-16 20:56

    One approach is to use sqlldr. First, create a small holding table:

    create table tstclob
    (
    id number,
    doc clob
    );
    

    Assuming your large document is the file "c:\data\test_doc.txt", create a sqlldr control file ("test_doc.ctl") to load it:

    load data
    infile *
    replace 
    into table tstclob
    fields terminated by ','
    (
     ID char(1),
     lob_file FILLER char,
      DOC LOBFILE(lob_file) TERMINATED BY EOF
     )
    begindata
    1,c:\data\test_doc.txt
    

    Then run sqlldr (in this case, from c:\data directory):

    sqlldr control=test_doc.ctl userid=someuser@somedb/somepass
    

    You can then update whatever table you want using tstclob table.

    0 讨论(0)
提交回复
热议问题