Help - Search - Members - Calendar
Full Version: trying to fetch the 845409-07112008.csv & 845429-07112008.csv. files from Ftp site using UTL.FTP
Oracle DBA Forums > Oracle > Oracle Forum
Devendrasaraswat
Hi ,

I am trying to fetch the 845409-07112008.csv & 845429-07112008.csv. files from Ftp site using UTL.FTP and UTL.GET file one by one but we have to process the file with the oldest date first.

I have done this for a fixed name of file but in the above code the name of file change
could you please provide me a logic for that.

thank's
SteveC
Simple shell scripting - parse the file name. You do need some kind of guarantee about the file name - either the leading part is a sequence number and smaller always equals older, or have the time embedded along with the date component.
aussie_dba
"could you please provide me a logic for that."

OK, you want to sort the csv file names, placing the oldest one first.

ls *.csv|sort > sorted_list.txt
SteveC
For the OP -

Assuming files all come from the same source and are posted in order. Lots of cases where date on the file system does not correspond to the time that counts (when a job started, when a job ended, no master-detail relationship, etc.).
Devendrasaraswat
QUOTE (SteveC @ Jul 14 2008, 04:29 PM) *
Simple shell scripting - parse the file name. You do need some kind of guarantee about the file name - either the leading part is a sequence number and smaller always equals older, or have the time embedded along with the date component.



Thank's Steve,
but iam working with oracle 8i and i have to do this with UTL.FTP package only.but we donot know the file name ,We have to fetch file one by one in oracle database.
Please help me it's urgent i have to do this in oracle itself.
HAL9000
"Please help me it's urgent "

Urgent matters should be done with Oracle tech support, not here.

http://metalink.oracle.com

To solve your problem, just read the file names into a PL/SQL array (using utl_file), sort the internal array, and process the list, in order.

If you don't know PL/SQL well enough to do this, try the scripts in Dr. Hall's PL/SQL book:

http://www.rampant-books.com/book_2006_1_plsql_tune.htm
Devendrasaraswat
QUOTE (aussie_dba @ Jul 14 2008, 04:31 PM) *
"could you please provide me a logic for that."

OK, you want to sort the csv file names, placing the oldest one first.

ls *.csv|sort > sorted_list.txt



Actually we donot know the name of the file initially,and we have to process file (with file name.this file have dynamic name not static EX: yestarday it generate 845409-07112008.csv & Next day it generate 845429-07112008.csv file So in this case we donot predict file name),My question Question is how we can process these files,Another possibility is that if Back date file and Cureent date file is available at ftp then we have to process back date file first but in this case we also do not know the file name that generate dynamically.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.