Oracle 函数【笔记】
来源:互联网 发布:mac os x破解版 编辑:程序博客网 时间:2024/06/05 18:47
1. Oracle Round 函数 (四舍五入)
描述 : 传回一个数值,该数值是按照指定的小数位元数进行四舍五入运算的结果。
如果两个整数都和value值等距离,那么round函数将返回较大的那个整数值。如果value是一个整数,则返回的就是value本身
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.46
var a = float.round(3.5); // 计算结果为a = 4;4和3与3.5等距离,取较大的数4
var b = float.round(-3.5); // 计算结果为b = -3
var c = float.round(0.5); // 计算结果为c = 1;1和0与0.5等距离,取较大的数1
var d = float.round(-0.5); // 计算结果为d = 0
Round 函数都是采用 Banker's rounding(银行家舍入)算法,即四舍六入五取偶
2.mod(number1,number2)
两个数值相除并返回其余数。(取模)
如果任一表达式为 Null,则 result 也为 Null。任一表达式为 Empty 时按 0 来处理。
如:round(3.5)=4 ,round(4.5)=4
3. SUBSTR( string, start_position, [ length ] )
string is the source string.
start_position is the position for extraction. The first position in the string is always 1.
length is optional. It is the number of characters to extract. If this parameter is omitted, substr will return the entire string.
for example:
substr('This is a test', 6, 2) would return 'is'
substr('This is a test', 6) would return 'is a test'
substr('TechOnTheNet', 1, 4) would return 'Tech'
substr('TechOnTheNet', -3, 3) would return 'Net'
substr('TechOnTheNet', -6, 3) would return 'The'
substr('TechOnTheNet', -8, 2) would return 'On'
Be Continued ...
- oracle 笔记2 函数
- Oracle 函数【笔记】
- Oracle函数学习笔记
- Oracle单行函数笔记
- oracle常用函数笔记
- oracle 函数笔记
- Oracle分组函数笔记
- oracle函数-笔记
- Oracle单行函数笔记
- ORACLE学习笔记 SQL 函数
- Oracle分析函数学习笔记
- Oracle笔记: Decode函数用法
- oracle学习笔记-decode函数
- Oracle笔记_内置函数
- Oracle笔记_单行函数
- Oracle笔记_分组函数
- Oracle之 SYS_CONNECT_BY_PATH 函数笔记
- oracle 分析函数(笔记)
- java中synchronized关键字作用分析
- sql 查询重复记录方法大全
- Ext2的一般特征
- java中synchronized关键字作用分析
- java中synchronized关键字作用分析
- Oracle 函数【笔记】
- java中synchronized关键字作用分析
- java中synchronized关键字作用分析
- MYSQL 复制数据库
- java中synchronized关键字作用分析
- .net程序员应对大规模高性能网站的一点思考
- java中synchronized关键字作用分析
- VS2005查看汇编代码
- java中synchronized关键字作用分析