Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: If clause in SELECT statements
hi,
you can use decode function.
select decode(state, 'NY', 'New York', state) as state_desc from state_tab
Hakan
Tim Gifford wrote:
>
> Is there any way to evaluate a field in a SELECT query w/o writting a User
> Function? This is an example of the logic that I would like to have in a
> view:
> select if([state]='NY','New York',[state]) as state_desc from state_tab
>
> If the state column is NY then it would output New York, otherwise, it would
> return the value from the field.
>
> Any Ideas,
> Tim Gifford
> tgifford(at)horizonstech.com
Received on Tue Jul 18 2000 - 00:00:00 CDT
![]() |
![]() |