oracle 常见函数
来源:互联网 发布:易语言web服务器源码 编辑:程序博客网 时间:2024/06/06 07:19
1.常见字符串操作函数
2.Trunc函数,Round函数(四舍五入),Mod函数(求余)操作
3.日期函数
4.通用函数
select upper('coolszy') from dual; --将小写字母转换成大写,dual 为一虚表 select lower('KUKA') from dual; --将大写字母转换成小写 select initcap('kuka') from dual; --将首字母大写 Kukaselect concat('Hello',' world') from dual; --连接字符串,但没有||好用select concat('Hello','world') from dual; select substr('hello',1,3) from dual; --截取字符串 helselect length('hello') from dual; --求字符串长度 5select replace('hello','l','x') from dual; --替换字符串 hexxoselect substr('hello',-4,3) from dual; --截取后三位 ell 从后面开始计算 -1 -2 -3 -4 select instr('abcd','a') from dual ; --寻找字符串的位置 1
2.Trunc函数,Round函数(四舍五入),Mod函数(求余)操作
select round(789.536) from dual; --四舍五入,舍去小数 790select round(789.536,2) from dual; --保留两位小数 789.54select round(789.536,-1) from dual; --对整数进行四舍五入 790select trunc(789.536) from dual; --舍去小数,但不进位 789select trunc(789.536,2) from dual; -- 保留两位小数 789.53select trunc(789.536,-2) from dual; -- 700select trunc(sysdate) from dual ; --得到2013/12/17表示日期不变select trunc(sysdate,'dd') from dual ; --得到2013/12/17表示日期不变select trunc(sysdate,'mm') from dual ; --得到2013/12/1 表示月份不变其他置为1select trunc(sysdate,'yyyy') from dual ; --得到 2013/1/1 表示年份不变其他置为1select mod(10,3) from dual; --返回10%3的结果 10 - 3*3 = 1 所以等于1
3.日期函数
select sysdate from dual; --返回当前日期 select months_between(sysdate,'27-5月 -13') from dual;--返回之间的月数 注意格式 13是年份 27是日期select add_months(sysdate,4) from dual; --在日期上加上月数 select next_day(sysdate,'星期一') from dual;--下个星期一的时间select last_day(sysdate) from dual; --求本月的最后一天
4.通用函数
select nvl(null,0) from dual; --如果为null,则用0代替 select decode(3,1,'内容是1',2,'内容是2',3,'内容是3') from dual;--类似于 switch...case...
0 0
- oracle 常见函数
- oracle 常见的函数
- Oracle常见函数汇总
- Oracle常见数字函数
- ORACLE常见函数
- oracle 常见函数
- oracle 常见函数
- Oracle常见函数
- oracle 常见函数
- Oracle常见函数
- Oracle常见函数
- oracle 常见函数
- oracle中常见函数
- oracle常见函数
- oracle常见函数应用积累
- ORACLE的一些常见函数
- oracle常见的函数总结
- oracle 时间转化函数及常见函数
- Junit4 Test Suit使用
- webhooks与jenkins配合使用时提示:HTTPStatus403-Novalidcrumbwasincludedintherequest
- JS计算时间差
- PHP无法启动502故障
- MySQL 存储过程游标的简单用法
- oracle 常见函数
- H5游戏颠覆手游的想象
- android 调用系统相册选取照片或者打开相机拍照获取图片,返回时回到手机桌面,然后才会跳转到当前activity
- Longest Word in Dictionary through Deleting
- Log4j学习总结-2
- bootstrap分页
- Log4j学习总结-3
- selenium从安装到使用
- Android Xposed框架 -- 开发篇