Technology Exchange
免费咨询热线
400-090-9964
upper()转换成大写:
select ename,upper(ename) from emp;
lower()转换成小写:
select ename,lower(ename) from emp;
initcap()单词首字母大写:
select ename,initcap(ename) from emp;
concat(str1,str2)连接字符串:
select concat('bei','jing') from dual;
substr()截取子串
select substr('beijing',1,3) from dual;
length()获得字符串长度
select length('beijing') from dual;
instr()字符串在字符串中的位置
select instr('beijing','jing') from dual;
lpad(),rpad()左补齐、右补齐
select 100,lpad(100,4,0),rpad(100,4,0) from dual;
trim()去除前后空格
select trim(' beijing ') from dual;
replace()替换
select replace('beijing','jing','ping') from dual;
round()数字四舍五入
select round(1234.56) from dual;
trunc()截断
select trunc(1234.56) from dual;
mod()求余数
select mod(100,30) from dual;
to_char()转换成字符
select 100,to_char(100,'$99,999.00') from dual;
to_number()转换成数字
select '$12,345.67',to_number('$12,345.67','$99,999.00') from dual;
to_date()转换成日期
select '01-02-99',to_date('01-02-99','dd-mm-yy') from dual;
next_day()下一个
select sysdate,next_day(sysdate,'monday') from dual;
last_day()最后一天
select sysdate,last_day(sysdate) from dual;
add_months()增加月份
select sysdate,add_months(sysdate,2) from dual;
months_between()间隔月份
select months_between(add_months(sysdate,5),sysdate) from dual;