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: Michel Cadot <micadot{at}altern{dot}org>
Date: Mon, 31 Jan 2005 18:22:06 +0100
Message-ID: <41fe6922$0$21787$636a15ce@news.free.fr>

"Andy Kent" <andykent.bristol1095_at_virgin.net> a écrit dans le message de news:1107186252.988112.34620_at_c13g2000cwb.googlegroups.com...
| 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?
|
| Many thanks
|
| Andy Kent
|

Pure SQL/SQL*Plus solution (without PL/SQL):

def flag=0
col flag noprint new_value flag
set feedback off
select table1.*, 1 flag from table1 where key=value; select * from table2 where key=value and &flag=1;

Regards
Michel Cadot Received on Mon Jan 31 2005 - 11:22:06 CST

Original text of this message

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