BIGINT

The BIGINT function returns a big integer representation of either a number or a character or graphic string representation of a number.

Numeric to Big Integer:

Read syntax diagram
>>-BIGINT(numeric-expression)----------------------------------><

String to Big Integer:

Read syntax diagram
>>-BIGINT(string-expression)-----------------------------------><

The schema is SYSIBM.

Numeric to Big Integer

numeric-expression
An expression that returns a value of any built-in numeric data type.

The result is the same number that would occur if the argument were assigned to a big integer column or variable. If the whole part of the argument is not within the range of big integers, an error is returned. The fractional part of the argument is truncated.

String to Big Integer

string-expression
An expression that returns a value of a character or graphic string (except a CLOB and DBCLOB) with a length attribute that is not greater than 255 bytes. The string must contain a valid string representation of a number.

The result is the same number that would result from CAST(string-expression AS BIGINT). Leading and trailing blanks are eliminated and the resulting string must conform to the rules for forming an integer constant. If the whole part of the argument is not within the range of big integers, an error is returned. Any fractional part of the argument is truncated.

The result of the function is a big integer.

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

To increase the portability of applications, use the CAST specification.

Example 1: The following function returns the number 12345 (a BIGINT) for the number 12345.6:
   SELECT BIGINT(12345.6) 
      FROM SYSIBM.SYSDUMMY1;
Example 2: The following function returns a BIGINT value of 123456789012 for the number 00123456789012.
   SELECT BIGINT('00123456789012') 
      FROM SYSIBM.SYSDUMMY1;