Press "Enter" to skip to content

How to Convert Number to Integer in Oracle?

There are two ways to convert a number to an integer in Oracle. The following are the examples.

1. Convert a Number to Integer Using TRUNC Function in Oracle

SELECT TRUNC (9.387) to_int FROM DUAL;

Output

TO_INT
----------
9
1 row selected.

2. Convert Using CAST Function in Oracle

SELECT CAST (9.33 AS INTEGER) int FROM DUAL;

Output

INT
----------
9
1 row selected.

See also: