If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Corresponding types must be compatible in CASE expression

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-07-11, 06:33
Helen Pippard Helen Pippard is offline
Registered User
 
Join Date: Dec 2011
Posts: 30
Corresponding types must be compatible in CASE expression

Hello,

I am very new to Informix and am looking for some advice

Can I ever get in case expression a different data type to be displayed in the field

I.e. clmov_loctype is a char field and clmov_movedate is a DATE field

Is there any way I can get the following expression to work, and pick up a date field instead of a char, as at the moment the conflicting data types errors as:
"Corresponding types must be compatible in CASE expression"

SELECT clmov_movedate,clmov_loctype,
CASE WHEN clmov_loctype IS NULL THEN clmov_movedate ELSE "BOOKED OUT" END type
FROM clinrec_movements

Any ideas?

Thanks
Helen
Reply With Quote
  #2 (permalink)  
Old 12-14-11, 20:39
domusonline domusonline is offline
Registered User
 
Join Date: Nov 2010
Posts: 12
Cast the datetime to char datatype.
The datatypes must match, because the client must know what datatype to expect and this can't be changed on a row by row basis...
to_char() could be used for your needs.
Regards.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On