Hi friends.
Im form Brasil, and it is my first topic.
I have a problem with a function case. Im trying convert a field, but i cant.
The function is :
CASE [region_id]
WHEN ('-1') THEN ('WORLD')
WHEN ('1') THEN ('EUROPA')
WHEN ('2') THEN ('ASIA')
WHEN ('3') THEN ('AFRICA')
WHEN ('4') THEN ('AMERICA')
WHEN ('25') THEN ('OCEANIA')
ELSE [region_id]
END
The following message appears :
QE-DEF-0405
Incompatible data types in case statement.
Where is the problem ?????
Excuse me for my bad english.
Thanks
Herrera
Herrera,
The problem is the data type of [region_id].
Try this:
CASE [region_id]
WHEN ('-1') THEN ('WORLD')
WHEN ('1') THEN ('EUROPA')
WHEN ('2') THEN ('ASIA')
WHEN ('3') THEN ('AFRICA')
WHEN ('4') THEN ('AMERICA')
WHEN ('25') THEN ('OCEANIA')
ELSE cast_char([region_id])
END
if your data base is Oracle use cast_varchar or to_char instead cast_char.
certo mano?
Quote from: zaith on 22 Nov 2007 01:59:15 PM
Herrera,
The problem is the data type of [region_id].
Try this:
CASE [region_id]
WHEN ('-1') THEN ('WORLD')
WHEN ('1') THEN ('EUROPA')
WHEN ('2') THEN ('ASIA')
WHEN ('3') THEN ('AFRICA')
WHEN ('4') THEN ('AMERICA')
WHEN ('25') THEN ('OCEANIA')
ELSE cast_char([region_id])
END
if your data base is Oracle use cast_varchar or to_char instead cast_char.
certo mano?
YES !
Its OK now !
Valeu Camarada !
heheh