Checking Null Indicators in DB2 UDFs

May 10, 2008 at 7:29 pm | In Uncategorized | 1 Comment

In SQLUDFs that we are coding,

Null values can be checked as

if (SQLUDF_NULL(NullInd)) /* Null */

Otherwise the Null indicators can be checked for value -1
i.e.
The Null Indicator variable will have value -1 when the corresponding variable is NULL, which is evident from the following piece of code..
(Refer http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.sql.doc/doc/c0023763.htm
for SQLUDFs)

Null Indicator

-1 : the field is null

0 : the field is not null

-2 : the field value is truncated

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.