Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to import an CSV file into a table with PL/SQL procedure

931440Apr 18 2012 — edited Apr 19 2012
hi,

I have an CSV file and i would like to import in a table from my database with a procedure in pl/sql. I search for this on forum and I found something like this
DECLARE @bulk_cmd varchar(1000)
SET @bulk_cmd = 'BULK INSERT name_database.table FROM ''C:\file.csv'' WITH (ROWTERMINATOR = '''+CHAR(10)+''')';
EXEC(@bulk_cmd);

or

'BULK INSERT name_database.table
FROM ''C:\file.csv''
WITH (ROWTERMINATOR = '''+CHAR(10)+''')'

but it doesn`t work. It works with PL/SQL import from txt file,etc.., but I want a procedure to include in my program.

Any suggestions or solutions?

Thx.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 17 2012
Added on Apr 18 2012
8 comments
6,670 views