I've inherited some code which is going to be the base for some additional work. Looking at the stored procs, I see quite a lot of associative-arrays.
Some of these are indexed by binary_integers, some by pls_integers. Are there any differences between the two?
I had a look at the documentation, but apart from this line:
The PL/SQL data types
PLS_INTEGER
andBINARY_INTEGER
are identical. For simplicity, this document uses PLS_INTEGER to mean bothPLS_INTEGER
andBINARY_INTEGER
.
I couldn't find any difference between the two. So what's the difference? Are both around for historical/compatibility reasons?
I'm using Oracle 10gR2
binary_integer
andpls_integer
both are same. Both are PL/SQL datatypes with range -2,147,648,467 to 2,147,648,467.Compared to
integer
andbinary_integer
pls_integer
very fast in excution. Becausepls_intger
operates on machine arithmetic andbinary_integer
operes on library arithmetic.pls_integer
comes from oracle10g.binary_integer
allows indexing integer for assocative arrays prior to oracle9i.Clear example:
Historical reasons. They used to be different before 10g:
Another difference between pls_integer and binary_integer is that when calculations involving a pls_integer overflow the PL/SQL engine will raise a run time exception. But, calculations involving a binary_integer will not raise an exception even if there is an overflow.