Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL*Plus question
On 31 Jan 2005 07:44:13 -0800, "Andy Kent" <andykent.bristol1095_at_virgin.net>
wrote:
>I've got a really simple requirement.
>Basically all I want to do is:
>
>select * from table1 where key=value;
>if found
>display it;
>else
>select * from table2 where key=value;
>display it;
>end if;
>
>I want to do it in the simplest possible .sql script so I can just
>invoke it from SQL*Plus. Should be standing-on-your-head stuff but I'm
>struggling to get my head around the interaction between SQL*Plus, SQL
>and PL/SQL in this.
>What should the script look like?
>
Off the top of my head, PL/SQL - something like
begin
select * from table 1 where key = value;
exception
when no_data_found then
select * from table 2 where key = value;
end;
Harry B Received on Mon Jan 31 2005 - 11:13:29 CST
![]() |
![]() |