Different data types as return value from CASE structure


#1

Hello together,

is there a possibility to print different data types with a CASE Structure?

Example:

CASE
WHEN HOURS_BETWEEN(…)>=0 THEN ‘Abgelaufen’
ELSE HOURS_BETWEEN(…)
END

I tried to use the function “STR_TO_INT” -> not working
I tried to cast with a variable -> not working

In other words:
Is there any possibility to print different data types in the same column with a control flow? (If/Case/Switch)

I would be happy about any reply!

BR\Andreas


#3

All values in column should be of one data type. You can not convert non-numeric text into DOUBLE, so you should convert your double values to string. Use something like " ELSE HOURS_BETWEEN(…) || ’ hours’ " and your formula will work.