Hi Folks,
I
have a task to create an oracle directory and assign access privileges to the
users. And create an external table; load the data through .CSV file.
So
that I have a created a directory in oracle and assigned access privileges to
the users as below:
|
|||||||||||||||||||||||||||||||||||||||||||
Creating an External Table:
Create a directory object pointing to the location of the files.CREATE OR REPLACE DIRECTORY test2 AS 'D:/test2';
EXAMPLE:
create table forecastforOct2013
create table forecastforOct2013
(YYYYMM number(20),
YYYYMMDD number(20),
DAY_NUMBER varchar2(25),
ship_day number(20),
channel varchar2(25),
reporting_group varchar2(26),
item_type varchar2(25),
forecast_qty_lbs varchar2(26),
forecast_amt varchar2(25)
)
organization external
(
type oracle_loader
default directory test2
access parameters
(
records delimited by newline
badfile 'forecastforOct2013.bad'
discardfile 'forecastforOct2013.dsc'
logfile 'forecastforOct2013.log'
fields terminated by ','
optionally enclosed by '"'
optionally enclosed by '"'
missing field values are null
)
location ('forecastforOct2013.csv')
)
reject limit unlimited ;
reject limit unlimited ;
- 1. Before executing this script we have created a directory called “test2” under D:/ folder and assigned read, wrote permissions to the oracle user .
- 2. Place the file (here: forecastforOct2013) in test2 directory.
- 3. Make sure that you have all the access permissions to the test2 directory and forecast... Files.
- Reference: http://www.oracle-base.com/articles/9i/external-tables-9i.php
- https://forums.oracle.com/thread/2576750
No comments:
Post a Comment