Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > load filenames to oracle table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-07, 19:56
maan_myra maan_myra is offline
Registered User
 
Join Date: Sep 2007
Posts: 7
load filenames to oracle table

I have csv filenames on my UNIX directory that I download from FTP site and here's what i want to do next....

copy all csv filenames (only) and insert to and oracle table with date at the end.

ex.
UNIX Filenames
file1.csv
file2.csv


ORACLE filenames after upload.
file1_071023.csv
file2_071023.csv
Reply With Quote
  #2 (permalink)  
Old 12-19-07, 12:57
PMASchmed PMASchmed is offline
Registered User
 
Join Date: Jun 2004
Location: Long Island
Posts: 400
You need to look at Oracle SQL*Loader (sqlldr) my friend.
Reply With Quote
  #3 (permalink)  
Old 12-20-07, 07:40
mike_bike_kite mike_bike_kite is offline
Registered User
 
Join Date: Jun 2007
Location: London
Posts: 955
Code:
#!/bin/ksh cd /your/directory/goes/here TODAY=`date '+%y%m%d'` for OLD_NAME in `ls -1 *.sh` do NEW_NAME=`echo $OLD_NAME | sed "s/\./_$TODAY./"` CONNECT_TO_DB <<- END_SQL insert MyTable values ( "$NEW_NAME" ) go END_SQL done exit 0
If you just want a shell script to store the filenames, with a date, in a table then the above should work fine. You'll need to :
  • set the correct directory
  • check the syntax for the insert (I haven't done Oracle for a long time)
  • put in the correct command and params to access your database from shell.

Mike
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On