Trunc Function (Number) Oracle

Trunc function truncates number to specified decimals

Synatx :

TRUNC(m,[n]) – Truncates to n decimal. n is optional

Examples:-

SQL> select trunc(25.48,1) from dual;

TRUNC(25.48,1)
————–
25.4

SQL> select trunc(25.4,1) from dual;

TRUNC(25.4,1)
————-
25.4

SQL> select trunc(25.6,1) from dual;

TRUNC(25.6,1)
————-
25.6

some more ….

trunc(25.6,-1) returns 20
trunc(25.6,0) returns 25
trunc(25.65,1) returns 25.6
trunc(25.45,0) returns 25

Advertisements

Author: sqlandplsql

To learn more about the Oracle, SQL, PL SQL, Performance Tuning, Database Modeling, Ubuntu, MySQL etc .Suggestions, comments, feedbacks and referrals are highly appreciated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s