RE: Reading files on the server
Simplest if you know the format of the files ... use external tables. Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message-From: Bellow, Bambi [mailto:[EMAIL PROTECTED]Sent: Friday, November 14, 2003 11:59 AMTo: Multiple recipients of list ORACLE-LSubject: RE: Reading files on the server There are really two answers to this and it depends largely on what you want to do. If you want to check for the existence of a file and generate an error if it's not there, you can do something along the lines of... whenever oserror !ls -l $DIR/$FILENAME Alternatively, if you want to do something that requires an action based on something inside the log file, you have to run the SQLPLUS command as a separate shell. Here's an example: sqlplus << EOF userofchoice/incrediblysecretpassword def somevar=`grep -i yourvar $DIR/$FILENAME|awk '{print $NForsomething}'` def somevar2=$SOMETHINGFROMEARLIERINTHISPGM select &somevar*&somevar2 from dual; exit EOF HTH, Bambi. -Original Message-From: Gunnar Berglund [mailto:[EMAIL PROTECTED]Sent: Thursday, November 13, 2003 10:14 PMTo: Multiple recipients of list ORACLE-LSubject: Reading files on the server Hi all, I have a problem I hope you could help with. I have a job running on db server side as a cron and it creates information (log files). What methods I have if I want to read those log files with some pl/sql procedure etc (I mean from inside the db), are there any others than utl_file (which I suppose reads always at the same directory...) I am using 9iRel2 on Sun Solaris... Thanks in advance Gunnar Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger**This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.**4
RE: Reading files on the server
There are really two answers to this and it depends largely on what you want to do. If you want to check for the existence of a file and generate an error if it's not there, you can do something along the lines of... whenever oserror !ls -l $DIR/$FILENAME Alternatively, if you want to do something that requires an action based on something inside the log file, you have to run the SQLPLUS command as a separate shell. Here's an example: sqlplus << EOF userofchoice/incrediblysecretpassword def somevar=`grep -i yourvar $DIR/$FILENAME|awk '{print $NForsomething}'` def somevar2=$SOMETHINGFROMEARLIERINTHISPGM select &somevar*&somevar2 from dual; exit EOF HTH, Bambi. -Original Message-From: Gunnar Berglund [mailto:[EMAIL PROTECTED]Sent: Thursday, November 13, 2003 10:14 PMTo: Multiple recipients of list ORACLE-LSubject: Reading files on the server Hi all, I have a problem I hope you could help with. I have a job running on db server side as a cron and it creates information (log files). What methods I have if I want to read those log files with some pl/sql procedure etc (I mean from inside the db), are there any others than utl_file (which I suppose reads always at the same directory...) I am using 9iRel2 on Sun Solaris... Thanks in advance Gunnar Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger
Re: Reading files on the server
Hi Gunnar, You can use utl_file, it doesn't read from the same directory, you specify utl_file_dir locations pre 9iR2 and directory objects 9iR2 onwards to where you want it to read from and then you open and read the fil3es you wish. You could also use external procedures and use C, you could use java database procedures? you could use an external table? hth kind regards Pete -- Pete Finnigan email:[EMAIL PROTECTED] Web site: http://www.petefinnigan.com - Oracle security audit specialists Book:Oracle security step-by-step Guide - see http://store.sans.org for details. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Pete Finnigan INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).