Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Generating Binary Column

Re: Generating Binary Column

From: Myron Wintonyk <mwintony_at_med.ualberta.ca>
Date: Fri, 16 Feb 2001 09:52:16 +1000
Message-ID: <3A8C6BB0.68FE0EB5@med.ualberta.ca>

Here are two ways:

       select X, case when X >= 5 THEN 1 ELSE 0 END as TheThing from TheTable

       select X, decode( sign(X), -1, 0, 1 ) as TheThing from TheTable

nevergiveup_at_my-deja.com wrote:

> Hello,
>
> I have Table T with Column X.
> I want to generate Column Y in the same table, or in the new view V.
>
> I want Y to have the value of 1 if X >= 5, and 0 if otherwise.
>
> How would I do this?
> I have been looking into Decode, and it doesn't seem to do it.
> I think Decode only works for text matching.
>
> Thank you,
>
> Gingko
>
> Sent via Deja.com
> http://www.deja.com/
Received on Thu Feb 15 2001 - 17:52:16 CST

Original text of this message

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