Friday, April 13, 2012

SQL-Loader:Loading variable length data

Loading Variable Length Data

The flat file is of comma seperated file(i.e csv). In real time we may have flat files with the extensions .csv, .dat, .txt etc
 
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:
load data
infile '/bin/flat_file_var.txt'   --Give your flatfile location
insert into table stu_data    --stu_data is the staging table
fields terminated by ','
optionally enclosed by '"'
trailing nullcols
(
sno,
sname,
branch,
year,
grade
)

Staging Table:
create table stu_data(sno number,
                                sname varchar2(20),
                                branch varchar2(10),
                                year varchar2(10),
                                grade varchar2(3)
                                )

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Casino Player Reviews & Ratings | JCM Hub
    Read casino player reviews and 당진 출장마사지 see casino 경기도 출장안마 player ratings 창원 출장마사지 for this game. If you 서울특별 출장안마 are a new player, 삼척 출장안마 here is a list of the top casino

    ReplyDelete