When you have to upload the data from os file (csv,txt..etc) into oracle db thn u can use external table use the below mentioned step.
1.Make the directry with name "raj" into c drive if having unix so make the directory.
2.copy the your file into raj folder as i have file with name "lory.txt" and below mentioned contents is written in file.
1, This is oracle.
2, this is sql server.
3.Create the database dir....
SYS@orcl>>create directory dir as 'c:\raj';
Directory created.
4. Create the table using below mentioned command.
Wrote file rajnish.txt
create table sweet
(employee_id number,
empl_comment varchar2(250))
organization external
(type oracle_loader
default directory dir
access parameters
(records delimited by newline
fields terminated by ','
(employee_id char,
empl_comment char)
)
location('lory.txt')
)
SYS@orcl>>/
Table created.
5. Check now you data has been uploaded into database.
SYS@orcl>>desc sweet
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPLOYEE_ID NUMBER
EMPL_COMMENT VARCHAR2(250)
SYS@orcl>>select * from sweet;
EMPLOYEE_ID
-----------
EMPL_COMMENT
--------------------------------------------------------------------------------
1
This is oracle.
2
this is sql server.
SYS@orcl>>
===Now Enjoy with oracle==
No comments:
Post a Comment