Solved

Import csv file using SQL loader in a shell

Posted on 2013-05-24
3
807 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

706 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

19 Experts available now in Live!

Get 1:1 Help Now