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:

Have you found the answer to your question? If not, you can discuss it with me in the comments section below or join my Q&A community OrclQA.com for developers and ask your question. It is FREE.

Vinish Kapoor

Follow

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

guest
0 Comments
Inline Feedbacks
View all comments