Solved

Import csv file using SQL loader in a shell

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bash Script to Analyze Oracle Schemas 11 124
Advice on a batch file that copies, moves, sftp's & deletes files 6 32
Unix Command (AIX) 3 39
Shell Script- gzip 5 45
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

685 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