Oracle 的pls_integer类型
来源:互联网 发布:域名怎么换dns 编辑:程序博客网 时间:2024/05/29 12:17
pls_integer类型
PLS_INTEGER可以存储一个有符号的整形值,其精度范围和BINARY_INTEGER一样,是:-2^31~2^31。
PLS_INTEGER和NUMBER比较起来,其优点是:
1).占有较少的存储空间;
2).可以直接进行算术运算(在NUMBER上不能直接进行算术运算,如果要计算,NUMBER必须先被转换成二进制)。所以在进行算术的时候PLS_INTEGER比NUMBER和BINARY_INTEGER快一些。
PLS_INTEGER和BINARY_INTEGER区别:
PLS_INTEGER进行的运算发生溢出的时候,会触发异常。但是当BINARY_INTEGER运算发生溢出时,如果可以指派给一个NUMBER变量(没有超出NUMBER的精度范围)的话就不会触发异常。
Benefits of Using PLS_INTEGER Datatype in PL/SQL
If you have a whole-number counter, for example in a loop or record counter, consider using a datatype ofPLS_INTEGER instead of INTEGER or NUMBER. When declaring an integer variable,PLS_INTEGER is the most efficient numeric datatype because its values require less storage than INTEGER or NUMBER values, which are represented internally as 22-byte Oracle numbers. Also,PLS_INTEGER operations use machine arithmetic, so they are faster than BINARY_INTEGER, INTEGER, or NUMBER operations, which use library arithmetic.
来源:http://gaijing814.iteye.com/blog/271620
--------------------------------------------------------------------------
PLS_INTEGER Datatype
You use the PLS_INTEGER datatype to store signed integers. Its magnitude range is -2147483648 to 2147483647, represented in 32 bits. PLS_INTEGER values require less storage than NUMBER values and NUMBER subtypes. Also, PLS_INTEGER operations use hardware arithmetic, so they are faster than NUMBER operations, which use library arithmetic. For efficiency, use PLS_INTEGER for all calculations that fall within its magnitude range. For calculations outside the range of PLS_INTEGER, you can use the INTEGER datatype.
Note:
The BINARY_INTEGER and PLS_INTEGER datatypes are identical. See "Change to the BINARY_INTEGER Datatype".
When a calculation with two PLS_INTEGER datatypes overflows the magnitude range of PLS_INTEGER, an overflow exception is raised even if the result is assigned to a NUMBER datatype.
You use the PLS_INTEGER datatype to store signed integers. Its magnitude range is -2147483648 to 2147483647, represented in 32 bits. PLS_INTEGER values require less storage than NUMBER values and NUMBER subtypes. Also, PLS_INTEGER operations use hardware arithmetic, so they are faster than NUMBER operations, which use library arithmetic. For efficiency, use PLS_INTEGER for all calculations that fall within its magnitude range. For calculations outside the range of PLS_INTEGER, you can use the INTEGER datatype.
Note:
The BINARY_INTEGER and PLS_INTEGER datatypes are identical. See "Change to the BINARY_INTEGER Datatype".
When a calculation with two PLS_INTEGER datatypes overflows the magnitude range of PLS_INTEGER, an overflow exception is raised even if the result is assigned to a NUMBER datatype.
tips:1)pls_integer类型也是数字类型,但和number类型不同,number可以存储实数,而pls_integer只能存储-2147483647到+2147483647之间的整数,如果使用pls_integer类型时发生溢出,系统将会报错。
2)binary_integer与pls_integer类似,在9.2版本以前大量使用,从9.2以后,从Oracle内部一些组件可以看的出,大有被pls_integer取代之势(pls_integer比binary_integer具有更少的存储开销和更好的访问性能,所以Oracle从9.2以后推荐你尽量能使用pls_integer就使用pls_integer)。它也是只能存储-2147483647到+2147483647之间的整数。
3)在oracle 11g中,又增加了一个新的类似的数据类型simple_integer,不过simple_integer不能包含空值,它的取值范围是[-2147483648..2147483647]。在11g中,simple_integer相对pls_integer在性能上又有所提高,如果在实际的pl/sql中既不需要overflow检查也不会包含null值,Oracle建议你使用simple_integer.
阅读全文
0 0
- Oracle 的pls_integer类型
- oracle中integer、pls_integer和number类型
- pls_integer类型
- pls_integer类型
- pls_integer类型
- PLS_INTEGER类型对性能的些许奉献
- Oracle中Binary_Integer与Pls_Integer 的区别
- Oracle中Binary_Integer与Pls_Integer 的区别
- ORACLE之 BINARY_INTEGER 与 PLS_INTEGER 的区别
- Oracle中Binary_Integer与Pls_Integer 的区别
- PLSQL中的类型与PLS_INTEGER
- PLS_INTEGER
- PLS_INTEGER
- PLS_INTEGER数据类型与BINARY_INTEGER的区别
- 存储过程中变量类型:number,pls_integer,small integer
- 学习PLS_INTEGER,BINARY_INTEGER,INTEGER,NUMBER的概念及性能差异
- oracle的字段类型
- Oracle的Number类型
- Linux操作系统中的系统调用接口
- java.lang.NoClassDefFoundError:org / springframework / cglib / transform / impl / MemorySafeUndeclar
- gdal播放视频代码
- JZOJ 5478. 【NOIP2017提高组正式赛】列队
- caffe分类训练不收敛原因分析
- Oracle 的pls_integer类型
- Java项目打war包的方法
- MYSQL 加载文件内容
- 例 6.9 有3个字符串,要求找出其中最大者。
- C语言基础之:32位机中用printf输出signed char的问题
- TCP/IP协议栈的几点思考
- cors实现跨域请求
- 遗传算法Scala实现
- 该条只用于测试,请忽略,谢谢