Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL*Plus question
Andy Kent schrieb:
> 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;
If the table structure is the same then
select *
from table1
where key1=value1
union
select *
from table2
where key2=value2 and
and 0 = (select count(*) from table1 where key1=value1)
would do it.
HTH, Peter Received on Mon Jan 31 2005 - 11:32:58 CST