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

Home -> Community -> Usenet -> comp.databases.oracle -> Re: using case, Valid statement?

Re: using case, Valid statement?

From: Michael Hill <hillmw_at_ram.lmtas.lmco.com>
Date: Thu, 19 Feb 2004 10:49:11 -0600
Message-ID: <4034E907.4240ADBE@ram.lmtas.lmco.com>

I can use decode like:

decode(
field1,'first',1,
decode(field1,'second',2,0
)
)

except that this has to be all nested and is very hard to work with. If I have nine items it becomes very ugly.

Michael Hill wrote:
>
> Is this a valid sql statement:
>
> SELECT
> case field1
> when 'first' then 1
> when 'second' then 1
> else null
> end
> FROM mytable
>
> Mike
Received on Thu Feb 19 2004 - 10:49:11 CST

Original text of this message

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