Solved

Import csv file using SQL loader in a shell

Posted on 2013-05-24
3
855 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.:
Suggested Courses

634 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