Monday, February 12, 2007

About SQL*Loader / Oracle Bulk Loader
  1. SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database. Its syntax is similar to that of the DB2 Load utility, but comes with more options. SQL*Loader supports various load formats, selective loading, and multi-table loads. http://www.orafaq.com/faq/what_is_sql_loader_and_what_is_it_used_for
  2. Example


I have a data files of inventories you want to load into your oracle database. my_data.txt

09-NOV-2006|Noke Shirt|68254701000037
09-NOV-2006|Adibas Pant|71565900330059
09-NOV-2006|Umbros Shoe|69840500270016


I want to load the data into this table below

SQL> CREATE TABLE my_inventory
2 (salesdate DATE,
3 product_name VARCHAR(50),
4 barcode VARCHAR(20));

Then the control file control.ctl

LOAD DATA
INFILE 'my_data.txt'
APPEND INTO TABLE my_inventory
FIELDS TERMINATED BY '|'
(salesdate ,
product_name,
barcode
)

To load the data simply invoke sqlldr command from my Oracle bin.
c:/ORACLE_HOME/bin/sqlldr /@ control=control.ctl

I will see below output created during the loading

Commit point reached - logical record count 1
Commit point reached - logical record count 2

No comments: