Re: Why Doesn't This Simple PL/SQL Code Work?




"DBA9999" <cdavis10717@xxxxxxxxxxx> a écrit dans le message de news: 1144780180.375527.204110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| 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 confirm that THIS_HOST is Configured
| 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;
|

No row -> error NO_DATA_FOUND -> OTHERS -> does nothing

OTHERS -> always add "RAISE;" else you can't know the error reason.

Regards
Michel Cadot


.



Relevant Pages

  • Re: Problems with new Microsoft Update
    ... Rem *any* line that is not already rem ... If there is an entry for local host rem that line, save, then test. ... The article talks about having windows update in the host file ...
    (microsoft.public.windowsupdate)
  • Re: Problems with new Microsoft Update
    ... The article talks about having windows update in the host ... By rem out those ... >> I have seen thus far is something related to the hosts file or DNS. ...
    (microsoft.public.windowsupdate)