Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

if statement in Informix SQL

2,208 views
Skip to first unread message

vchu via DBMonster.com

unread,
Apr 11, 2008, 10:46:46 AM4/11/08
to
Can someone help me to convert something like this in Informix SQL?

select
when arriveDT > appointmentDT then "OT"
when arriveDT <= appointmentDT then "Normal"
else "unknown"
from contract

thanks
vchu

--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums.aspx/informix/200804/1

Art S. Kagel (Oninit)

unread,
Apr 11, 2008, 12:05:21 PM4/11/08
to vchu via DBMonster.com, inform...@iiug.org
vchu via DBMonster.com wrote:
> Can someone help me to convert something like this in Informix SQL?
>
> select
> when arriveDT > appointmentDT then "OT"
> when arriveDT <= appointmentDT then "Normal"
> else "unknown"
> from contract
>
> thanks
> vchu
Not so different:

select
case


when arriveDT > appointmentDT then "OT"
when arriveDT <= appointmentDT then "Normal"
else "unknown"

end
from contract;

Art S. Kagel
Oninit


vchu via DBMonster.com

unread,
Apr 11, 2008, 1:10:47 PM4/11/08
to
thanks a lots :)


Art S. Kagel (Oninit) wrote:
>> Can someone help me to convert something like this in Informix SQL?
>>

>[quoted text clipped - 6 lines]


>> thanks
>> vchu
>Not so different:
>
>select
> case
> when arriveDT > appointmentDT then "OT"
> when arriveDT <= appointmentDT then "Normal"
> else "unknown"
> end
>from contract;
>
>Art S. Kagel
>Oninit

--
Message posted via http://www.dbmonster.com

ii...@perrior.net

unread,
Apr 14, 2008, 10:01:38 AM4/14/08
to

Just a tiny note: if you're parsing your output, or want to put it
into a temp table, you'll need to specify a name for the returned
value (Informix will just return "(expression)" as the identifier.
Just add your preferred identifier to the 'end' statement, e.g.

select
case
<stuff>
end arriveDT_status
from contract

(or whatever you want to call it).

Malc

0 new messages