Computing.Net > Forums > Unix > Redirecting the output of a PL/SQL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Redirecting the output of a PL/SQL

Reply to Message Icon

Name: nauj
Date: October 1, 2008 at 12:55:19 Pacific
OS: AUX
CPU/Ram: IBM
Product: IBM
Comment:

I want to redirect the output of a PL/SQL procedure to a log file. In this file I want to have all the output of the execution, the results of every step, errors, etc..

I have tried with a UNIX pipe ( >> sql_log.txt) and with spool sentences, but it dosen’t work.

Can anybody help me??

Attached the UNIX script which call the procedure.

Any advice will be greatly appreciated.

---
#!/bin/ksh
echo "Executing procedure pl/sql"
SQLPLUS="sqlplus -s /"
ESQUEMA="esquema1"
echo "\
call ${ESQUEMA}.Z_PROC_PRUEBA();" | $SQLPLUS
echo "Controlling pl/sql execution"
var_err=$?
if [ $var_err -gt 0 ]
then
echo "Error executing pl/sql"
else
echo "pl/sql finished sucessfully"
fi



Sponsored Link
Ads by Google

Response Number 1
Name: wollie
Date: October 2, 2008 at 02:11:23 Pacific
Reply:

you should do the spooling within SQL:

spool /directory/file;
sql...
sql...
sql...
spool off;

cheers
Wollie


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Redirecting the output of a PL/SQL

update the contents of a file in Un www.computing.net/answers/unix/update-the-contents-of-a-file-in-un/5963.html

Inserting a string at the end of a www.computing.net/answers/unix/inserting-a-string-at-the-end-of-a-/6205.html

to append the end of a line www.computing.net/answers/unix/to-append-the-end-of-a-line/6100.html