Friday, April 13, 2012

SQL-LOADER:Skip option

Skip

In order to skip the rows at the beginning of the flat file.We use skip option in the control file as shown below.
If I want to skip 5 rows i will give skip=5 in my control file then the first five rows of the flat file are skiped and remaining data will be loaded in the staging table.
 
FLAT FILE:
 1,"Nani","CSE","Final","A+"
2,"Indra Kanth","ECE","Final","B"
3,"Kalyan","CSE","Third","A"
4,"Praveen","IT","Third","B"
5,"Badra","ECE","Final","B+"
6,"Kali","EEE","Second","C"
7,"Giri","E&I","First","D"
8,"Sravan","MCA","Third","A"
9,"Pradeer","MCA","Second","D"
10,"Joe","CSE","Third","D+"

CONTROL  FILE:
Options (skip=n)    --First n rows will be skiped
load data
infile 'bin/flat_file_var.txt' --Give your flat file location
insert into table stu_data
fields terminated by ','
optionally enclosed by '"'
(
sno,
sname,
branch,
year,
grade
)

3 comments:

  1. can u help me in skipping the record in between............

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete