--coalesce 返回首个不为null的对象
select coalesce(null,null,3,4,5) from dual
--decode和sign
select decode(sign(100-100),1,'大',-1,'small',2,'equal',0) from dual;
--ascii 字符——>十进制数
select ascii('你'),ascii('好') from dual;
--chr 十进制数——>字符
select chr(50403) zhao,chr(47811) chr65 from dual;
--contact 连接两个字符串
select concat('010-','88888888') from dual;
--initcap 返回首字母大写的字符串
select initcap('sabc') from dual;
--instr 被搜索字符串,搜索的字符串,搜索开始位置,出现的位置
select instr('sabcdabc','a',1,1) from dual;
--length字符串长度
select length('sabc') from dual;
--lower 大写——>小写
select lower('SABVVS') from dual;
--upper 小写——>大写
select upper('sabc') from dual;
--lpad rpad 处理的字符串,保留的长度,填充的字符(默认为空格)
select lpad('aaa',6,'-') from dual;
select rpad('bbb',7,'*') from dual;
select rpad(lpad('aaa',7,'-'),12,'-') from dual;
--ltrim rtirm删除左边、右边的字符
select ltrim('aaabbbccc','a') from dual;
--trim 去空格
select trim(' aaabb ') from dual;
--substr 截取的字符串,开始位置,截取个数
select substr('abcdefg',3,2) from dual;
--replace 替换
select replace('abbbbb','b','a') from dual;
--soundex 读音相同的字符串...
select soundex('what') from dual;
--abs绝对值
select abs(-100) from dual;
--acos反余弦 asin反正弦 sin正弦 cos余弦
select acos(1) from dual;
--atan反正切值
select atan(1) from dual;
--ceil大于等于该数字的最小整数
select ceil(3.141592657) from dual;
--exp e的n次方
select exp(2) from dual;
--floor 数字取整
select floor(213.234) from dual;
--power 返回n1 的 n2次方值
select power(2,4) from dual;
--round 根据指定精度经行四舍五入
select round(-55.127,2),round(55.555,2) from dual;
--trunc根据指定精度经行截取
select trunc(-55.127,2),trunc(55.555,2) from dual;
--add_months 时间,增加的月份数
select add_months(to_date('201212','yyyymm'),2),add_months(to_date('201301','yyyymm'),-1) from dual;
--last_day 月份的最后一天
select last_day(sysdate) from dual;
--months_between月份间隔
select months_between(to_date('201212','yyyymm'),to_date('201302','yyyymm')) from dual;
--next_day 下一个日期
select next_day(sysdate,'星期五') from dual;
--to_char
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
--to_date
select to_date('2013-01-28 14:15:22','yyyy-mm-dd hh24:mi:ss') from dual;
--to_number
select to_number('234') from dual;
--bfilename(dir,file)指定一个外部二进制文件
insert into table_col1 values(bfilename('clob_dir','image1.jpg'));
--empty_blob empty_clob 初始化大数据
insert into tableName(nameCol,blobCol)values('名称',empty_blob());
--greatest 取得最大值
select greatest('啊','不','吃') from dual;
select greatest(1,2,3) from dual;
--least 取得最小值
select least('啊','不','吃') from dual;
--user 得到当前用户名
select user from dual;
--userenv(opt) 用户环境信息 opt的值可以为:lable,client_info,vsize
--isdba是否是DBA
select userenv('isdba') from dual;
--sessionid会话标志
select userenv('sessionid') from dual;
--entryid会话人口标志
select userenv('entryid') from dual;
--instance返回当前instance的标志
select userenv('instance') from dual;
--language 返回当前环境变量字符集
select userenv('language') from dual;
--lang 环境的语言的缩写
select userenv('lang') from dual;
--terminal用户的终端或机器的标志
select userenv('terminal') from dual;
--avg/sum/max/min/stddev(distinct/all) 平均值/总和/最大值/最小值/标准差
select avg(distinct colA) from tableA;
--group by分组统计
--having 对分组统计加限制条件
--order by 排序
coalesce
coalesce
coalesce
coalesce