Thursday, April 16, 2009

Sql Loader

SQL Loader

Step-1. Write these statement in NOTEPAD and save as “ sample.ctl “
LOAD DATA
INFILE ‘sample.dat’
BADFILE ‘sample.bad’
DISCARDFILE ‘sample.dis’
APPEND
INTO TABLE test
( sno POSITION(1:10) , name POSITION(11:30) , class POSITION(31:40))
Step-2. Create a file named as “sample.dat” using notepad having following data.
1 ALI ONE
2 KAMRAN ONE
3 BILAL THREE
4 SAAD FIVE
5 ALI SIX
6 FAHAD NINE
7 ALI MATRIC
8 HARIS TWO
Step-2. Create a table named as test.
SQL> CREATE TABLE test
(SNO NUMBER, NAME VARCHAR2(15), CLASS VARCHAR2(10)) ;
Step-3. Now COMMAND prompt and run the following statement.
C:\ > SQLLDR scott/tiger control=sample.ctl direct=Y

No comments: