Connecting Tech Pros Worldwide Forums | Help | Site Map

sqlplus/oracle database

Newbie
 
Join Date: Jul 2007
Posts: 2
#1: Jul 17 '07
How do i turn off the spool in my script if the query returns 0 records??

debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,509
#2: Jul 18 '07

re: sqlplus/oracle database


You need to do that manually by

SET SPOOL OFF
Newbie
 
Join Date: Jul 2007
Posts: 2
#3: Jul 18 '07

re: sqlplus/oracle database


Quote:

Originally Posted by debasisdas

You need to do that manually by

SET SPOOL OFF


currently in my script I have my spool info and then it runs my sql query and then I spool off and exit. But if the sql returns 0 records I don't want it to spool the output. Do I need to do a "count" sql statment of the records first before my acutal query and then use a variable before I run my sql to set on/off the spool based on the count of records? How would I write the syntax?

thanks much for any direction...
Reply