this directory contains a file, book1.csv
so logon to sys as sysdba
then issue the command
create or replace directory EXTERNAL as 'E:\EXTERNAL\';
GRANT READ, WRITE ON DIRECTORY EXTERNAL TO SCOTT;
Now connect scott
now issue the following script :
create table extern_emp
(
id varchar2(10),
name varchar2(200),
address varchar2(1000)
)
organization external
(
default directory EXTERNAL
access parameters
(
records delimited by newline
fields terminated by ','
)
location('book1.csv')
)
parallel
;
But the CSV files are comma-seperated.
Any field of the csv file may contain comma.
So the previous script will be the following with highlighted portion:
create table extern_emp
(
id varchar2(10),
name varchar2(200),
address varchar2(1000)
)
organization external
(
default directory EXTERNAL
access parameters
(
records delimited by newline
fields terminated by ','
optionally enclosed by '"'
)
location('book1.csv')
)
parallel
;
No comments:
Post a Comment