assume text file is like this:
1: 60,CONSULTING,TORONTO
2: 70,HR,OXFORD
3: 80,EDUCATION,
Then user can write a control file of import as following:
1: LOAD DATA
2: INFILE 'depts.txt'
3: BADFILE 'depts.bad'
4: DISCARDFILE 'depts.dsc'
5: APPEND
6: INTO TABLE DEPT
7: FILEDS TERMINATED BY ','
8: TRAILING NULLCOLS
9: (DEPTNO INTEGER EXTERNAL(2),
10: DNAME,
11: LOC)
execute OS command:
1: sqlldr control=depts.ctl log=depts.log
results of select: 1: SQL> select * from iolab.dept;
2:
3: DEPTNO DNAME LOC
4: ---------- -------------------- ----------
5: 60 CONSULTING TORONTO
6: 70 HR OXFORD
7: 80 EDUCATION
Hints:One can use method of “Direct Path” to load data from text file.It load content from text file and write it to datafile directly,not like normal way of generating SQL sentences to insert every row to tables.