18 August 2008

Select NULL

Because NULL doesn't have a type, so DB2 doesn't know what to do with it. You need to use CAST function.

Syntax:
CAST (NULL AS data-type)

select cast(null as char(10)) as MyNull from sysibm.sysdummy1;
select cast(null as integer) as MyNull from sysibm.sysdummy1;

sysibm.sysdummy1 is the system table using for select system value.

No comments: