4. Elements of OpenSQL Statements : Functions : Ifnull Function : Ifnull Result Data Type
 
Share this page                  
Ifnull Result Data Type
If the arguments are of the same data type, the result is of that data type. If the two arguments are of different data types, they must be of comparable data types.
When the arguments are of different but comparable data types, the DBMS Server uses the following rules to determine the data type of the result:
The result type is always the higher of the two data types; the order of precedence of the data types is as follows:
date > money > float4 > float > decimal > integer > smallint > integer1
and
c > text > char > varchar > long varchar > byte > byte varying > long byte
The result length is taken from the longest value. For example:
ifnull (varchar (5), c10)
results in c10.
The result is nullable if either argument is nullable. The first argument is not required to be nullable, though in most applications it is nullable.