Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011
    Posts
    82

    Unanswered: 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

  2. #2
    Join Date
    Nov 2010
    Posts
    16
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •