Start of change

ODD scalar function

The ODD scalar function returns a Boolean value that indicates whether the argument is not divisible by two.

Authorization: None required.

Read syntax diagramSkip visual syntax diagram ODD (EXPRESSION => expression )
The schema is SYSTOOLS.
expression
An expression that returns a value of any built-in numeric, character-string, or graphic-string data type. The argument is cast to big integer before evaluating the function. Any fractional digits are truncated.

If the argument can be null, the result can be null; if the argument is null, the result is the null value.

The result of the function is Boolean. If the number is not evenly divisible by 2, it returns a value of true. Otherwise, it returns a value of false.

Note

This function is provided in the SYSTOOLS schema as an example of extending an SQL built-in function. Similar to other Db2® for i provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper functions, or to create a customized version within a user-specified schema.

Example

  • Determine whether the input argument is an odd number.
     VALUES SYSTOOLS.ODD(17);
    Returns TRUE.
End of change