0

I am very new at this, I need to insert .csv file placed on windows C: drive into oracle11g database. thinking of using sql loader, but not sure where to start.

sorry I don't have any code.

1 Answer 1

3

Create a target table (if you don't have it):

M:\>sqlplus scott/tiger@orcl

SQL*Plus: Release 11.2.0.1.0 Production on Sri Tra 21 12:04:48 2021

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> create table my_table (id number, name varchar2(20));

Table created.

SQL>

Sample data file (as you didn't post yours), named my_data.csv, located in a root of my M disk (yours is C):

1,Little
2,Foot

Control file (named test37.ctl):

load data
infile 'm:\my_data.csv'
truncate into table my_table
fields terminated by ','
(id, 
 name
)

Run SQL*Loader from operating system command prompt:

M:\>sqlldr scott/tiger@orcl control=test37.ctl log=test37.log

SQL*Loader: Release 11.2.0.1.0 - Production on Sri Tra 21 12:08:40 2021

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Commit point reached - logical record count 1
Commit point reached - logical record count 2

M:\>

Check what we've done:

M:\>sqlplus scott/tiger@orcl

SQL*Plus: Release 11.2.0.1.0 Production on Sri Tra 21 12:09:15 2021

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select * from my_table;

        ID NAME
---------- --------------------
         1 Little
         2 Foot

SQL>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.