1.round 반올림
1
2
3
4
|
--<숫자함수>
--1.round(숫자, 자리수)=> 반올림
select round(12.345678, 0), round(12.345648, 2), round(12.548789, 0)
from dual;
|
cs |
결과) 12 12.35 13
2.ceil 올림 후 정수반환
1
2
3
|
--2.ceil(숫자) => 올림 한 후 정수반환
select ceil(12.34), ceil(-12.34)
from dual;
|
cs |
결과) 13 -12
3.floor 내림 후 정수반환
1
2
3
|
--3.floor(숫자)=>내림 한 후 정수 반환
select floor(12.34), floor(-12.34) from dual;
|
cs |
결과) 12 -13
4.mod 나머지
1
2
3
|
--4.mod(숫자, 나눌수) => 나머지
select mod(5, 2) from dual;
select mod(pay, 10000000) from emp2;
|
cs |
결과) 1
5.trunc 버림
1
2
3
|
--5.trunc(숫자, 자리수)=> 버림
select trunc(12.3456, 2), trunc(12.3756, 2), trunc(12.7456, 0)
from dual;
|
cs |
결과) 12.34 12.37 12
'Database > Basic' 카테고리의 다른 글
concat (0) | 2021.02.09 |
---|---|
문자열함수-upper,lower,initcap,length와lengthb,substr과substrb,instr,lpad,Rpad,Itrim,rtrim (0) | 2021.02.08 |
집합(그룹) 함수-sum,avg,max,min,count,rank + GROUP BY , HAVING (0) | 2021.02.08 |
between, order by(오름차순과 내림차순) (0) | 2021.02.08 |
조건연산자(like, or, and, in, between, any, all, not, null) (0) | 2021.02.08 |