Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Your help is much appreciated.In a prompt in Appworx
the variable name is SPOOLFILE,
so I am moving the path to
oSPOOLFILE. The path is {#DS_OUTPUT_DIRECTORY}/DS_CS_DQ_MO_RC_output.txtIs that correct.Also I put an exit in my sqlplus,
so I commented out the second SQLplus command.Can you please tell me how to get my spooled output from the sql into the $SPOOLFILE?
oSPOOLFILE= $SPOOLFILE
export oSPOOLFILE
echo $oSPOOLFILE
#
# set the local connection variable, login,password/dbs
# export the local variable to convert to environment variable that will be visible by the program
#
EDW_CONN_STR=$db_login/$db_password$net_connect
export EDW_CONN_STR#
# print the text listed
#
echo "Updating T_ETL_DQ_QUERY_RESULTS table ..."
#
# login to the database and execute the "Student" row count queries
#
sqlplus -s ${EDW_CONN_STR} @/prod/DS/sql/DS_CS_DQ_MO_RC.sql
echo "came back from sql"
echo $oSPOOLFILE
#sqlplus -s ${EDW_CONN_STR} >$oSPOOLFILE<<-EOF
set echo off feed off veri off pages 0 head off
# Spool file to network location
unix2dos $oSPOOLFILE $oSPOOLFILE 2>/dev/null
twc=`grep T_ $oSPOOLFILE|wc -l`

well, what about:
spool outputfilename;
sql-cmd;
sql-cmd;
... ... ... :
spool off;within your sql-session?
it can be done either interactively or included in a batch filecheers
Wollie

Thank you very much for your help and your response. I have
the spool off in the sqlplus. I had to add an 'exit' so it would return to the unix script. I need to write the spooled results to this 'SPOOLFILE' that is in the unix script, but since I exited in the sqlplus... the command ' ${EDW_CONN_STR} >$oSPOOLFILE<<-EOF' no longer works..... (I am supposed to modify this script'. How can I write what came from the
sqlplus to the $oSPOOLFILE?

SPOOL is an SQLPLUS command ... just start it with "spool filename" and use "spool off" at the moment you don't want data to be logged anymore, all within the SQL session. There's nothing more to it.
You can redirect ouput to a file, but that has nothing to do with the SQL spooling, this is unix redirecting:
sqlplus user/pass $/some/file.sql > /some/output.log
In this example, don't use SQLPLUS spooling, as you already are logging output on OS level.

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |