![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| unix script for loading a data from a file into database | grajesh_955 | Shell Programming and Scripting | 5 | 11-08-2008 11:49 PM |
| Howto capture data from rs232port andpull data into oracle database-9i automatically | boss | UNIX for Dummies Questions & Answers | 1 | 09-23-2007 02:35 AM |
| Need Shell Script to upload data from Text file to Oracle database | chandrashekharj | Shell Programming and Scripting | 6 | 03-26-2007 03:21 AM |
| How to export data file from Unix | whatisthis | UNIX for Dummies Questions & Answers | 20 | 03-03-2005 02:16 PM |
| export table from oracle database | inquirer | Shell Programming and Scripting | 1 | 06-24-2003 09:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
unix script to export data from csv file to oracle database
Hello people,
Need favour. The problem I have is that, I need to develop a unix shell script that performs recurring exports of data from a csv file to an oracle database. Basically, the csv file contains just the first name and last name will be dumped to an Unix server. The data from these files then need to be exported to an oracle database. I wonder if anyone has done anything similar to this. Does anyone have a shell script that I can borrow? Any help will be appreciated. Thanks. Vina |
|
||||
|
I use sqlldr on a monthly basis as follows:
1. Create a control file - filename.ctl 2. Create an executable script - load_file (or whatever you want to call it) 3. Make sure the file you want to load does not change name or type, mine is just called start.csv and in comma seperated format. Write some error checking code for this. ##filename.ctl## load data infile start.csv into table contact append fields terminated by ',' optionally enclosed by '"' ( URN, TITLE, FIRST_NAME, OTHER_NAME, LAST_NAME ) ##load_file## sqlldr scott/tiger control=filename.ctl ##start.csv - first record example## "0061031","Mr","B","A","Williams" load_file will look at the control file and import the values from start.csv as required. If you sure the file is being placed in a directory it is worth while checking whether it exists before trying to import it into oracle else abort. sqlldr does create a filename.log in the directory where you specified unless you specify a path as shown with the example by vgersh99. Pretty basic but with a cron job should be able to get it working easily. Hope this helps. |
|
||||
|
Thanks to you both DirkLottering and vgersh99. I'll try it. If i want to make it as recurring process, can I do it by control file ?
I'm new to unix so bear with me if its silly question. thanks again. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|