其中一些由binary_integers索引,一些由pls_integers索引。两者之间有什么区别吗?
我看了一下the documentation,但除了这一行:
The PL/sql data types
PLS_INTEGER
andBINARY_INTEGER
are identical. For simplicity,this document uses PLS_INTEGER to mean bothPLS_INTEGER
andBINARY_INTEGER
.
我找不到两者之间的区别。那有什么区别呢?由于历史/兼容性的原因吗?
我正在使用Oracle 10gR2
On 8i and 9i,PLS_INTEGER was noticeably faster than BINARY_INTEGER.
When it comes to declaring and manipulating integers,Oracle offers lots of options,including:
INTEGER – defined in the STANDARD package as a subtype of NUMBER,this datatype is implemented in a completely platform-independent fashion,which means that anything you do with NUMBER or INTEGER variables should work the same regardless of the hardware on which the database is installed.
BINARY_INTEGER – defined in the STANDARD package as a subtype of INTEGER,variables declared as BINARY_INTEGER can be assigned values between -231 .. 231,aka -2,147,483,647 to 2,647. Prior to Oracle9i Database Release 2,BINARY_INTEGER was the only indexing datatype allowed for associative arrays (aka,index-by tables),as in:
TYPE my_array_t IS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER
PLS_INTEGER – defined in the STANDARD package as a subtype of BINARY_INTEGER,variables declared as PLS_INTEGER can be assigned values between -231 .. 231,647. PLS_INTEGER operations use machine arithmetic,so they are generally faster than NUMBER and INTEGER operations. Also,prior to Oracle Database 10g,they are faster than BINARY_INTEGER. In Oracle Database 10g,however,BINARY_INTEGER and PLS_INTEGER are now identical and can be used interchangeably.