Oracle API笔记
来源:互联网 发布:polyfit函数的算法 编辑:程序博客网 时间:2024/06/05 00:13
1、ROUND 四舍五入
SELECT ROUND( number, [ decimal_places ] ) FROM DUAL参数:number : 欲处理之数值decimal_places : 四舍五入 , 小数取几位 ( 预设为 0 )
Sample :select round(123.456, 0) from dual; 回传 123 select round(123.456, 1) from dual; 回传 123.5 select round(123.456, 2) from dual; 回传 123.46 select round(123.456, 3) from dual; 回传 123.456 select round(-123.456, 2) from dual; 回传 -123.462、 --Oracle trunc()函数的用法
/**************日期********************/
1.select trunc(sysdate) from dual --2011-3-18 今天的日期为2011-3-18
2.select trunc(sysdate, 'mm') from dual --2011-3-1 返回当月第一天.
3.select trunc(sysdate,'yy') from dual --2011-1-1 返回当年第一天
4.select trunc(sysdate,'dd') from dual --2011-3-18 返回当前年月日
5.select trunc(sysdate,'yyyy') from dual --2011-1-1 返回当年第一天
6.select trunc(sysdate,'d') from dual --2011-3-13 (星期天)返回当前星期的第一天
7.select trunc(sysdate, 'hh') from dual --2011-3-18 14:00:00 当前时间为14:41
8.select trunc(sysdate, 'mi') from dual --2011-3-18 14:41:00 TRUNC()函数没有秒的精确
/***************数字********************/
/*
TRUNC(number,num_digits)
Number 需要截尾取整的数字。
Num_digits 用于指定取整精度的数字。Num_digits 的默认值为 0。
TRUNC()函数截取时不进行四舍五入
*/
9.select trunc(123.458) from dual --123
10.select trunc(123.458,0) from dual --123
11.select trunc(123.458,1) from dual --123.4
12.select trunc(123.458,-1) from dual --120
13.select trunc(123.458,-4) from dual --0
14.select trunc(123.458,4) from dual --123.458
15.select trunc(123) from dual --123
16.select trunc(123,1) from dual --123
17.select trunc(123,-1) from dual --120
Oracle截取字符串和查找字符串
oracle 截取字符(substr),检索字符位置(instr) case when then else end语句使用 收藏 常用函数:substr和instr1.SUBSTR(string,start_position,[length]) 求子字符串,返回字符串解释:string 元字符串 start_position 开始位置(从0开始) length 可选项,子字符串的个数For example:substr("ABCDEFG", 0); //返回:ABCDEFG,截取所有字符 substr("ABCDEFG", 2); //返回:CDEFG,截取从C开始之后所有字符 substr("ABCDEFG", 0, 3); //返回:ABC,截取从A开始3个字符 substr("ABCDEFG", 0, 100); //返回:ABCDEFG,100虽然超出预处理的字符串最长度,但不会影响返回结果,系统按预处理字符串最大数量返回。 substr("ABCDEFG", -3); //返回:EFG,注意参数-3,为负值时表示从尾部开始算起,字符串排列位置不变。
2.INSTR(string,subString,position,ocurrence)查找字符串位置解释:string:源字符串 subString:要查找的子字符串 position:查找的开始位置 ocurrence:源字符串中第几次出现的子字符串For example:INSTR('CORPORATE FLOOR','OR', 3, 2)中,源字符串为'CORPORATE FLOOR', 目标字符串为'OR',起始位置为3,取第2个匹配项的位置;返回结果为 14 '
- Oracle API笔记
- API 笔记
- API 笔记
- ORACLE 的C API
- oracle api小结
- oracle 集合 API
- Oracle EBS API使用说明
- Oracle官方API地址
- Oracle笔记
- Oracle笔记
- oracle笔记
- Oracle 笔记!
- oracle笔记
- oracle 笔记
- ORACLE笔记
- oracle笔记
- ORACLE笔记
- oracle 笔记
- IOS 应用程序间跳转
- c调用javascript
- 每日一算法:全排列的递归算法与非递归算法
- 技术不牛如何才拿到国内IT巨头的Offer
- Metronic V1.5.2 Responsive Admin Dashboard Template build with Twitter Bootstrap 3.0
- Oracle API笔记
- 基于石墨烯的微波毫米波器件在国防航空领域的应用
- php smarty
- sql 行转列 PIVOT 列转行 UNPIVOT
- Spring中的FactoryBean
- 新浪微博的页面解析思考
- DC、CDC及CDC的各个子类
- Keepalived原理与实战精讲
- 报表定义无效。详细信息: 报表定义具有无法升级的无效目标命名空间“http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefi