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: HOWTO: Use result of and EXISTS test in SELECT list?

Re: HOWTO: Use result of and EXISTS test in SELECT list?

From: Martin Haltmayer <Martin_Haltmayer_at_KirchGruppe.de>
Date: 1998/03/03
Message-ID: <34FC4130.47185ED4@KirchGruppe.de>#1/1

select column1, column2, aux.column3
from ...,
(SELECT DECODE (<any SQL statement that returns NULL if not existing>, NULL, 0, 1) ...) aux
...

Martin Haltmayer

Randy Baker wrote:
>
> In Access and SQL Server, I can use an abomination of the following form:
>
> select column1, column2, (EXISTS SELECT <any SQL statement>) as column3 from
> <table, join, query, etc>.
>
> The column to which the EXISTS clause is bound is 0 if the EXISTS clause is
> false, non-zero otherwise. Is there an easy way to do this in Oracle?
>
> Note that in any situtaion in which I use this, the SELECT clause within the
> the EXISTS table is dependent on the tables being queried in the main
> SELECT, so I can substitute a left/right outer join and test for NULL in the
> joined column.
>
> --
> Randy Baker (remove Z from address in email replies)
Received on Tue Mar 03 1998 - 00:00:00 CST

Original text of this message

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