Monday, January 21, 2013

HowToOracle:-How to insert a xml in a CLOB field in a Oracle table

Step 1:- Create a sample table as follows:-
create table my_clob_table ( id VARCHAR2(32), data CLOB);

Step 2:-
Create a control file as follows:-
test.ctl
-----------------

LOAD DATA
INFILE *
append
   INTO TABLE my_clob_table
   FIELDS TERMINATED BY ','
   (
id           CHAR(32),
clob_filename FILLER char,
  data         LOBFILE(clob_filename) TERMINATED BY EOF
)
begindata
eeeeee8a525e4e0e4e1,C:\TESTFOLDER\1810358.xml

Run sqlldr as:-
sqlldr userid=dbuser/dbpassword@orcl control=C:\TESTFOLDER\test.ctl

** Here C:\TESTFOLDER\1810358.xml is your xml which you want to insert in my_clob_table.data field.

 Click for more information :-

Labels: