sql loader:
sql loader is a utility provided by oracle to load data from external files into
database object.
1.flat file : It's includes structured data,with each line representing a record
amd fields
separated by delimiters.
2.control file: This file defines the structure of flat file also contains the
information
about target table to load the data.
3.bad file : A file generated by sql loader that contains records that couldn't
be
loaded due to error,such as formatting issues or constraints
violations.
4.discard file: A file produced by sql loader that contains record which were
rejected
during the loading process based on specific critiria defined
in the control file.
5.log file : A file created by sql loader that captures detailed information
about the
loading process,including statistics and any encountered errors.
create table sql_sample (id number,name varchar2(30),dp_id number);
desc sql_sample;
select * from sql_sample;
sample.txt
id,name,dp_id
1,sundar,10
2,rajesh,10
3,muthu,20
4,ravi,30
controlfile.ctl
options (skip=1)
load data
infile 'sample.txt'
discardfile 'dis_file.txt'
truncate into table sql_sample
when dp_id="10"--(for rows skip)
fields terminated by ','
(id,name,dp_id)--filler(for column skip)
connected to commandprompt
C:\Users\lenovo>cd C:\Users\lenovo\Desktop\sundar
C:\Users\lenovo\Desktop\sundar>sqlldr hr/1234 control=controlfile.ctl