Trunc Function Examples

Example 1

select trunc(123.897) from dual;
Result: '123'
select trunc(123.897,0) from dual;
Result: '123'
select trunc(123.897,2) from dual;
Result: '123.89'
select trunc(-123.897,2) from dual;
Result: '-123.89'
select trunc(-123.897,-1) from dual;
Result: '-120'
select trunc(-123.897,-2) from dual;
Result: '-100'

Example 2

select trunc(to_date ('06-NOV-11'),'YEAR') from dual;
Result: '1/1/2011'
select trunc(to_date ('06-NOV-11'),'Q') from dual;
Result: '10/1/2011'