AS400 Misc Scalar Functions


COALESCE(E1,E2,...)
Returns the first expression that is not null in the list.

Example: COALESCE(Salary,0) would return Salary if the column is not null or 0 if it is.

IFNULL(X,Y)
Returns Y if X is null. See COALESCE.

LAND(E1,E2,...)
Returns the logical and of expressions E1,E2,...

LENGTH(X)
Returns the length of X. X can be any data type. If not a string, the length is the byte length of the datatype.

    2 for small integer
    4 for large integer
    4 for single-precision float
    8 for double-precision float

LNOT(E1,E2,...)
Returns the logical not of expressions E1,E2,...

LOR(E1,E2,...)
Returns the logical OR of expressions E1,E2,...

RRN()
Returns a DB2 relative record number.

VALUE(E1,E2,E3,...)
See COALESCE

XOR(E1,E2,...)
Returns the XOR value of E1 XOR E2 XOR ...