binary_integer
和pls_integer
都是一樣的。兩者都是範圍爲-2,147,648,467到2,147,648,467的PL/SQL數據類型。
與integer
和binary_integer
pls_integer
相比非常快。因爲pls_intger
在機器算術上運行,而binary_integer
在庫運算上運行。
pls_integer
來自oracle10g。
binary_integer
允許分度整數爲oracle9i的前assocative陣列。
明顯的例子:
SET TIMING ON
declare
num integer := 0;
incr integer := 1;
limit integer := 100000000;
begin
while num < limit loop
num := num + incr;
end loop;
end;
PL/SQL procedure successfully completed.
Elapsed: 00:00:20.23
ex:2
declare
num binary_integer := 0;
incr binary_integer := 1;
limit binary_integer := 100000000;
begin
while num < limit loop
num := num + incr;
end loop;
end;
/
PL/SQL procedure successfully completed.
Elapsed: 00:00:05.81
ex:3
declare
num pls_integer := 0;
incr pls_integer := 1;
limit pls_integer := 100000000;
begin
while num < limit loop
num := num + incr;
end loop;
end;
/
這裏是9i的文檔,其中提到的差異,但沒有進入太多細節:http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96624/03_types.htm#10531無論如何,它現在已經過時了。 – Thilo
很好,謝謝相關鏈接和解釋! – Sathya
但請看下面的鏈接: http://www.oracle.com/technetwork/database/features/plsql/documentation/new-plsql-features-in-action-doc-129893.pdf Binary_Integer的實現基於在哈希像數據結構,所以它應該是更快的搜索 和PLS_INTEGER排序,因爲它們在B上實現* - 樹 – logicalgeek