Monday, March 7, 2011

loading csv files into database tables

hi friends,

if u have files like excel,notepad,.dat ,.csv that u want to load in database tables especially in oracle then u can follow the following procedure
1. first save the file in .csv format
2. then create a table in the target database of same credentials like in file.
3. then make a control file containing code of loading the data in table.
4.then both the control file and .csv file save it at same location.
5.open the command prompt run the sql loader command .
i am giving an example .....
first the .csv format file like below
then create a table using sql commands to create a table,
then make a control file like below to load the data
and save it as.ctl file
and finally using sql loader command in command prompt
c:> sqlldr scott/tiger@orcl control=c:\book.ctl data = c:\book.csv
it will load the data in table

Thanks and regards
Ankur Gupta

No comments:

Post a Comment