We always looking to squeeze that extra performance to make our PL/SQL programs, functions and procedures run just a little bit faster?
Hey, you already have them optimized, right ? have u ?
For example in a loop or record counter,
which one u will use NUMBER or INTEGER... what thinking abt answer to this question ?.
if u have answered anyone of this u r wrong.
Answer shud h've been "options not enough"
Still using number or integer for the counter field, throw up those variables , use PLS datatypes.
Well, consider using the PL/SQL datatype pls_integer instead of the number datatype where only integers are needed.
When declaring an integer variable, PLS_INTEGER is the most efficient numeric datatype because its values require less storage than INTEGER or NUMBER values, which are represented internally as 22-byte Oracle numbers. The number datatype is a memory hog compared to pls_integer, which is designed to consume very little resource at runtime, specifically for PL/SQL.
Also, PLS_INTEGER operations use machine arithmetic, so they are faster than BINARY_INTEGER, INTEGER, or NUMBER operations,which use library arithmetic.
Let us see what is this datatype
This datatype is available in PL/SQL Release 2.3 and above.
Variables declared as PLS_INTEGER store signed integers. The magnitude range for this datatype is -2147483647 through 2147483647. Oracle recommends that you use PLS_INTEGER for all integer calculations which do not fall outside of its range. PLS_INTEGER values require less storage than NUMBER values, and operations on PLS_INTEGER's use machine arithmetic, making them more efficient.
Variables declared as pls_integer and binary_integer have the same range, but they are treated differently. When a calculation involving pls_integer overflows, pl/sql raises an exception. However, similar overflow involving binary_integers will not raise an exception if the result is being assigned to a number variable.
wait for more posting to get what is " Library / machine arithmetic " .
0 comments:
Post a Comment