Whenever Not Found

Hi
I have a SQL script with SELECT queries.
1. If the query returns no/zero rows, a message has to be printed on the screen.
2. The output has to be spooled.

Script:
[color=Blue]whenever sqlerror exit failure rollback;
spool on
spool a
set heading on
set feedback off
set verify off
select empno from emp where rownum<10;
select ename from emp where ENAME='12345';
WHENEVER NOT FOUND sqlprint;
spool off[/color]

The 'WHENEVER NOT FOUND' gives a 'Usage' error. A message needs to be printed if no data is selected. I also cannot use a procedure for this as i need the spooled output.

Is there a solution to this?

Thanks
Lakshmi
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories