Function Reference > Functions > TO_BIGINT
  

TO_BIGINT

Converts a string or numeric value to a bigint value. TO_BIGINT syntax contains an optional argument that you can choose to round the number to the nearest integer or truncate the decimal portion. TO_BIGINT ignores leading blanks.

Syntax

TO_BIGINT( value [, flag] )
Argument
Required/
Optional
Description
value
Required
String or numeric datatype. Passes the value you want to convert to a bigint value. You can enter any valid expression.
flag
Optional
Specifies whether to truncate or round the decimal portion. The flag must be an integer literal or the constants TRUE or FALSE:
  • - TO_BIGINT truncates the decimal portion when the flag is TRUE or a number other than 0.
  • - TO_BIGINT rounds the value to the nearest integer if the flag is FALSE or 0 or if you omit this argument.
The flag is not set by default.

Return Value

Bigint.
NULL if the value passed to the function is NULL.
0 if the value passed to the function contains alphanumeric characters.

Examples

The following expressions use values from the IN_TAX source column:
TO_BIGINT( IN_TAX, TRUE )
IN_TAX
RETURN VALUE
'7,245,176,201,123,435.6789'
7,245,176,201,123,435
'7,245,176,201,123,435.2'
7,245,176,201,123,435
'7,245,176,201,123,435.2.48'
7,245,176,201,123,435
NULL
NULL
'A12.3Grove'
0
'    176,201,123,435.87'
176,201,123,435
'-7,245,176,201,123,435.2’
-7,245,176,201,123,435
'-7,245,176,201,123,435.23'
-7,245,176,201,123,435
-9,223,372,036,854,775,806.9
-9,223,372,036,854,775,806
9,223,372,036,854,775,806.9
9,223,372,036,854,775,806
TO_BIGINT( IN_TAX )
IN_TAX
RETURN VALUE
'7,245,176,201,123,435.6789'
7,245,176,201,123,436
'7,245,176,201,123,435.2'
7,245,176,201,123,435
'7,245,176,201,123,435.348'
7,245,176,201,123,435
NULL
NULL
'A12.3Grove'
0
'    176,201,123,435.87'
176,201,123,436
'-7,245,176,201,123,435.6789'
-7,245,176,201,123,436
'-7,245,176,201,123,435.23'
-7,245,176,201,123,435
-9,223,372,036,854,775,806.9
-9,223,372,036,854,775,807
9,223,372,036,854,775,806.9
9,223,372,036,854,775,807