Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic spool file names

user41097Aug 27 2010 — edited Aug 27 2010
I have a sql script and I'm having trouble creating the spool file name dynamically. I will be running it from the command line and I want to pass in a string (&1) to the script (such as "prepatch" or "postpatch") to be used in the spool file name. I also want to pick up the value of a couple environment variables such as the $ORACLE_SID and a directory path. If the $ORACLE_SID=db1, the directory path variable $PATCHES=/ora/patches, and the value passed in is "prepatch", the file name should look something like this:
$PATCHES/invobjs_$ORACLE_SID_&1.log ---> /ora/patches/invobjs_db1_prepatch.log

Does anyone have any suggestions as to how this can be done? Any and all suggestions are appreciated.

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2010
Added on Aug 27 2010
1 comment
665 views