Re: Why Doesn't This Simple PL/SQL Code Work?
- From: "Michel Cadot" <micadot{at}altern{dot}org>
- Date: Tue, 11 Apr 2006 20:45:19 +0200
"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
.
- References:
- Why Doesn't This Simple PL/SQL Code Work?
- From: DBA9999
- Why Doesn't This Simple PL/SQL Code Work?
- Prev by Date: Re: oracle10g manual database cloning
- Next by Date: Re: Why Doesn't This Simple PL/SQL Code Work?
- Previous by thread: Why Doesn't This Simple PL/SQL Code Work?
- Next by thread: Re: Why Doesn't This Simple PL/SQL Code Work?
- Index(es):
Relevant Pages
|