AIM--->>
"we have need to load data into TABLE from ".CSV" file using "sql loader".
Basically this kind of operation is need when client want to load "RAW Data" in his databse manually,
that time this technic is used.
Actually there are lots of s/w which is used for this operation but use of this method is a sign of
standard programming.
------------------------------------------------------------------------------------------------------
TASK--->>
load the data of "abc.csv" file into table "abc" using "abc.ctl"
---------------------------------------------------
create table "abc" in databse.
ex-
create table abc(
id number,
name varchar2(25)
);
----------------abc.ctl----------------------------
OPTIONS ( SKIP=1)
LOAD DATA
INFILE '/u02/dev/abc.csv'
APPEND
INTO TABLE abc
fields terminated by ';' TRAILING NULLCOLS
( id,
name
)
--------------------------------------------------
--------abc.csv contain following data------------
ID;NAME
1;aaa
2;rohit
3;rat
4;rani
---------------------------------------------------------------
How to execute--->
1-go on Putty.
2-type following command
SQLLDR apps/apps abc.ctl
syntax--> Sqlldr username/password(of database) ".ctl_file_name"
Here my database username=apps
password=apps
After executing this command see the table "ABC" you will find all data of "abc.csv "file in that table.
ex --select * from abc
o/p
id name
1 aaa
2 rohit
3 rat
4 rani
------------------------------------------------------------
in above all exmple i usesame name for each file..means..abc.ctl,,abc.csv, table name is abc....
so it is not necessory to use same name u can use diff names......
----------------------------------------------------------------
No comments:
Post a Comment