oracle学习之函数

函数(一)单行函数

--小写、大写、驼峰
select lower('ABCDSE'),UPPER('abcde'),initcap('java')
from dual;

--拼接、截取、长度
select concat('hello','beijing'),substr('helloworld',1,5),length('hello')
from dual;

--首次出现的问题
select instr('hello','l') from dual;

--左对齐,右对齐
select lpad(salary,10,'*')
from EMPLOYEES;
select rpad(salary,10,'*')
from EMPLOYEES;

--替换(去除首尾的字符串)
select trim('h' from 'helloworhhld') from dual;
--替换(全部替换)
select replace('helloworhhld', 'l','m') from dual;


--数字函数
-- (四舍五入)
select round(435.45,2),round(435.45),round(435.45,-2)
from dual;

--截断(四舍五入)
select trunc(435.45,2),trunc(435.45),trunc(435.45,-2)
from dual;

-- 求余
select mod(435,100)
from dual;
posted @ 2021-12-04 16:59  King-DA  阅读(50)  评论(0)    收藏  举报