Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL*Plus question

Re: SQL*Plus question

From: Harry Boswell <Harry_Boswell_at_@deq.state.ms.us>
Date: Mon, 31 Jan 2005 11:13:29 -0600
Message-ID: <ulpsv0dphhdbsa9s8q9g06trum76f30kiu@4ax.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US