> But CAST(NULL AS VARCHAR) should make it a varchar so i should be able
> to || the both values. So perhaps a bug in CAST.
>
> The only way here would be to make a CASE WHEN - i think thats not a
> good behavoir.
NULL is null even it have varchar type, it is not an empty string. Try to do
the following:
select field1 || case when field2 is null then '' else field2 end from
my_big_table;