Solved

Import csv file using SQL loader in a shell

Posted on 2013-05-24
3
810 Views
Last Modified: 2013-05-26
Hi,

I would like to import a csv file to a temporary table using SQL loader and write this whole logic in a  shell. Can you please help me. I am kind of new to shell scripting

Temporary_table _name = trades_temp
cvs file name - test.csv

Kindly suggest
0
Comment
Question by:d27m11y
3 Comments
 
LVL 37

Accepted Solution

by:
Gerwin Jansen earned 500 total points
ID: 39195318
Use sqlloader and a .ctl file (per .csv) that loads the records. Just have a look at the sqlldr reference, it has some samples.

Sample ctl file: (call it sqlldr.ctl)

load data
 infile 'employee.txt'
 into table employee
 fields terminated by ","
 ( id, name, dept, salary )

Sample script:

sqlldr scott/tiger control=sqlldr.ctl
0
 
LVL 13

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 39195400
There are many many examples out there (see google):

e.g.: http://sureshvaishya.blogspot.de/2010/03/based-on-request-from-one-of-our-reader.html
0
 

Author Closing Comment

by:d27m11y
ID: 39197653
Useful
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now