Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Why Doesn't This Simple PL/SQL Code Work?
OK, I give up, I can not make this simple pl/sql code block give me a
message when no data is returned from a table.
I correctly get the output line when a row is returned, but not when no row is returned.
What am I doing wrong, please?
Thanks so much.
C
REM ==================================================REM
REM ==================================================
set serveroutput on
declare
this_host varchar2(25) := NULL; this_nmon_dir varchar2(25); this_temp_dir varchar2(25);
begin
select
host, nmon_dir, temp_dir into this_host, this_nmon_dir, this_temp_dir from nmon.nmon_server_config where host = '&1'
begin
dbms_output.put_line('HOST VALUE IS '||this_host); end;
if
this_host is NULL
then
begin dbms_output.put_line('HOST NOT CONFIGURED....EXITTING;'); end; else begin dbms_output.put_line('HOST '||this_host||' CONFIGURED....EXITTING;'); end;
end if;
exception
when case_not_found then
this_host := NULL;
when others then rollback;
end;
.
run;
Received on Tue Apr 11 2006 - 13:29:40 CDT