Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: newbie: conditions in expressions
A copy of this was sent to rosinowski_at_gmx.de (Jan Rosinowski)
(if that email address didn't require changing)
On Fri, 29 Jan 1999 14:51:23 GMT, you 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;
select decode( 1, 1, 'True', 'False' ) as mytrue from dual;
>
>nor
>
>select ord(0 is not null) as mytrueint from dual;
>
select decode( 0, NULL, 0, 1 ) from dual
>nor
>
>select if 1=1 then 42 else 0 endif as
select decode( 1, 1, 42, 0 ) as ....
>
>work?!
>
>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)?!
>
read about decode, its like an if, then, else if, then, else if.... function
>ciao, jan
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Jan 29 1999 - 09:08:53 CST