Hi,
It means that Vertica has to be able to convert all of you results (the values in your THEN and ELSE clauses) all to the single data type.
So for instance, Vertica can't convert the string to an integer in the following statement so it fails:
Code: Select all
dbadmin=> select case when 1 = 1 then 1 else 'Can not be a string' end;
ERROR 3681: Invalid input syntax for integer: "Can not be a string"
In this example, all the results have to be convertible to either an integer data type...
Code: Select all
dbadmin=> select case when 1 = 1 then 1 else 0 end;
case
------
1
(1 row)
Or a string data type...
Code: Select all
dbadmin=> select case when 1 = 1 then '1' else 'Can be a string' end;
case
------
1
(1 row)
I hope this simple example helps!