Performance of pls_integer type

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.