Loading Data from Multiple Flat-files
FLAT FILE1:
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+"
FLAT FILE2:
11,"Dev","CSE","Final","A+"
12,"sasi Kanth","ECE","Final","B"
13,"johnny","CSE","Third","A"
14,"isaac","IT","Third","B"
15,"Babu","ECE","Final","B+"
16,"Kiran","EEE","Second","C"
17,"Gangadhar","E&I","First","D"
18,"Suresh","MCA","Third","A"
19,"Pavan","MCA","Second","D"
20,"Joseph","CSE","Third","D+"
CONTROL FILE:
load data
infile '/bin/flat_file1.txt'
infile '/bin/flat_file2.txt'
insert into table vnk_mul_data
fields terminated by ','
optionally enclosed by '"'
trailing nullcols
(
sno,
sname,
branch,
year,
grade
)
Here we have two flat-files named flat_file1,flat_file2. The Control file stores the data from these two data files into the staging table vnk_mul_data
Staging table:
create table vnk_mul_data(sno number,
sname varchar2(20),
branch varchar2(10),
year varchar2(10),
grade varchar2(3)
)
This comment has been removed by the author.
ReplyDelete