In this post, we will learn about How to
Skip header records while loading using SQL*Loader.
SQL*Loader is an
Oracle-supplied utility that
allows we to load data from one or more file into one or more
database tables.
Control File Syntax:
bindsize = n
direct = {TRUE | FALSE}
errors = n
load = n
multithreading = {TRUE | FALSE}
parallel = {TRUE |FALSE}
readsize = n
resumable = {TRUE | FALSE}
resumable_name = 'ant_string'
resumable_timeout = n
rows = n
silent = {HEADER | FEEDBACK | ERRORS | DISCARDS | PARTITIONS | ALL}
skip = n
skip_index_maintenance = { TRUE | FALSE}
skip_unusable_indexes = { TRUE | FALSE}
streamsize = n
If we need to skip unwanted header records or continue an interrupted load data by specifying the
"SKIP=n" keyword.
"n" specifies the
number of logical rows to skip. Look at these examples:
employee.txt (Data File)
ID,NAME,DEPARTMENT,SALARY
10,Akash,HomeLoanSales,15000
20,Kufu,Life Insurance,11000
30,Krishna,Sales,17000
40,Amol,Marketing,19500
50,Satya,Antivirus,16000
example1.ctl (Control File)
OPTIONS (SKIP=1)
LOAD DATA
INFILE 'd:\dataupload\employee.txt'
INSERT into table employee
field terminated by "," optionally enclosed by " "
( id, name, dept, salary)
Note:- In above data file, data contain header row also, to need skip while data loading we have specify OPTIONS (SKIP=1) in control file. If we want skip how many top row of data that row no we can set in control file.
Note:- If we are continuing a multiple table direct path load, we may need to use the CONTINUE_LOAD clause instead of the SKIP parameter.
CONTINUE_LOAD allows we to specify a different number of rows to skip for each of the tables we are loading.
No comments:
Post a Comment
Please do not enter any spam link in the comment box.