Program.../Oracle

Oracle 숫자형 함수 - round, trunc

Duritz 2009. 3. 13. 20:14

---- round, trunc 함수
select 45.195, round(45.195), round(45.195,0),
    round(45.195,1), round(45.195,2), round(45.195,-1),
    round(45.195,-2), round(54.195,-2)
    -- round(숫자, x) : 해당숫자의 X자리까지만 나타낸다. 사라지는 부분은 반올림되어진다.
from dual;

select 45.195, trunc(45.195), trunc(45.195,0),
    trunc(45.195,1), trunc(45.195,2), trunc(45.195,-1),
    trunc(45.195,-2), trunc(54.195,-2)
    -- trunc(숫자, x) : 해당숫자의 X자리까지만 나타낸다. 사라지는 부분은 절삭한다.
from dual;