oracle的几种数字类型区别?

[复制链接]
查看11 | 回复9 | 2011-2-18 11:42:47 | 显示全部楼层 |阅读模式
关于binary_integer和pls_integer.网上看到的一段话:
 PLS_INTEGER和BINARY_INTEGER唯一区别是在计算当中发生溢出时,BINARY_INTEGER型的变量会被自动指派给一个NUMBER型而不会出错,PLS_INTEGER型的变量将会发生错误。

这句话的意思是不是说声明pls_integer类型的变量完全可以用binary_integer类型给替代。那么pls_integer类型存在的价值是什么?
还有以上两种类型的变量是不是都可以被number类型给替换掉。

回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
PLS_INTEGER 性能好
回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
做数学计算的时候性能好
否则和number没有啥区别
回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
The PL/SQL data types PLS_INTEGER and BINARY_INTEGER are identical. For simplicity, this document uses PLS_INTEGER to mean both PLS_INTEGER and BINARY_INTEGER.
The PLS_INTEGER data type stores signed integers in the range -2,147,483,648 through 2,147,483,647, represented in 32 bits.
The PLS_INTEGER data type has these advantages over the NUMBER data type and NUMBER subtypes:
?PLS_INTEGER values require less storage.
?PLS_INTEGER operations use hardware arithmetic, so they are faster than NUMBER operations, which use library arithmetic.
For efficiency, use PLS_INTEGER values for all calculations in its range.

回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
LZ头像求包养以刚~
回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
谢谢各位!
回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
0x0x0x 发表于 2012-6-18 17:13
LZ头像求包养以刚~

what?
回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
大号拖鞋 发表于 2012-6-18 17:16
what?



回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
本帖最后由 〇〇 于 2012-6-18 20:45 编辑
dingjun123 发表于 2012-6-18 17:06
做数学计算的时候性能好
否则和number没有啥区别

测试一下吧,整数运算差不多的,浮点倒是float和double快很多
回复

使用道具 举报

千问 | 2011-2-18 11:42:47 | 显示全部楼层
已经没区别了,见4楼第一句话。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行