For exampleIf pls_integer is used, Oracle uses the native machine algorithm.
All other numeric data types Use the C Language Algorithm Library like the number data type
The result is that the pls_integer value is much faster than the number integer.
In addition, pls_integer does not encounter compatibility issues when porting the hardware platform
For intensive integer operations, we recommend that you use pls_integer
However, if frequent pls_integer and number data interactions, we recommend that you use number at the beginning.
Do not use pls_integer because pls_integer is used for integer calculation and the result is rounded up.
Test the experiment:
hr@ORCL> edWrote file afiedt.buf 1 DECLARE 2 j PLS_INTEGER :=0; 3 BEGIN 4 FOR i IN 1..1000000 5 LOOP 6 j:=i+1; 7 IF j=1000 8 THEN 9 dbms_output.put_line('Hello Think'); 10 END IF; 11 END LOOP; 12* END;hr@ORCL> /Hello ThinkPL/SQL procedure successfully completed.Elapsed: 00:00:00.28hr@ORCL> edWrote file afiedt.buf 1 DECLARE 2 j NUMBER :=0; 3 BEGIN 4 FOR i IN 1..1000000 5 LOOP 6 j:=i+1; 7 IF j=1000 8 THEN 9 dbms_output.put_line('Hello Think'); 10 END IF; 11 END LOOP; 12* END;hr@ORCL> /Hello ThinkPL/SQL procedure successfully completed.Elapsed: 00:00:00.36