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: newbie: conditions in expressions

Re: newbie: conditions in expressions

From: Jonathan Gennick <gennick_at_worldnet.att.net>
Date: 31 Jan 1999 01:12:03 GMT
Message-ID: <36c4a6d6.4574604@netnews.worldnet.att.net>


On Fri, 29 Jan 1999 14:51:23 GMT, rosinowski_at_gmx.de (Jan Rosinowski) wrote:

>i seem to miss some very basic concept in oracle, but how can i use
>conditions in select-expressions?
>
>neither
>
>select (1=1) as mytrue from dual;
>

<snip>

SQL does not recognize a boolean datatype. Thus you can never select the result of a boolean expression such as (1=1).

>do i really have to code functions for stuff like "col is null" or use
>unions (select 1 from a where col is null union select 0 from a where
>col is not null)?!

You might be able to use the DECODE function.

	select 1 from a where col is null union select 0 from a 
	where col is not null

is equivilant to:

        select DECODE(col,null,1,0)

That still leaves you dealing with 1 and 0, and not TRUE and FALSE. regards,

Jonathan Received on Sat Jan 30 1999 - 19:12:03 CST

Original text of this message

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