Dynamic spool file names
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!