6 SQL Loader
6 SQL Loader
------------------------------------
The process of loading the data from flat file to Oracle Apps Base tables.
Process
-------------------
SQL*Loader Import Program
xls -----------> csv ----------------------> Interface table
----------------------> Base table
SQL*Loader
--------------------------------
It is tool used to load the data from file to a table.
It requires control file to load the data.
Its is developers responsibility to create .ctl file.
LOAD DATA
infile '<data file path >'
insert / append/ truncate into table <table_name > fields terminated by ','
( col1, col2, coln )
Ex:
------------
LOAD DATA
infile 'C:\data\student_data.txt'
insert into table student fields terminated by ','
( sno, sname, marks )
----------------------------------------
ctl file
-----------------------
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
insert into table student fields terminated by ','
( sno, sname, marks )
Save.
++++++++++++++++++++++++++++++++++++
Program -- MZ_STUDENT_LOAD_PROG
++++++++++++++++++++++++++++++++++++++++
options ( load = 5 )
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
truncate into table student fields terminated by ','
( sno, sname, marks )
+++++++++++++++++++++++++++++++++++++++
options ( skip = 5 )
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
truncate into table student fields terminated by ','
( sno, sname, marks )
+++++++++++++++++++++++++++++++++++++++++
Bad file
-------------
Contains rejected rows.
Bad file information is available in log file.
Bad file name is same as request ID
++++++++++++++++++++++++++++++++++++++++++++++
104,"arun,rao",40
105,"arun,rao",40
Ex:
-------
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
truncate into table student fields terminated by ',' optionally enclosed by
'"'
( sno, sname, marks )
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++