Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Storing real *large* integer values - ideas?
K Fein wrote:
>
> All,
>
> Any ideas for representing large integer values within ORACLE7's
> datatypes? Say, 10 times larger than a numeric(40)... Ideas for storing
> values in another base, say, base(256) or base(32767) or...??? Of
> course, the translation to base(10) could be a pl/sql procedure but I'd
> like to index the value(s) because this is the unique identifier for
> the record.
> --
> thanks in adv,
> kevin
> *******************************************************************
> * K. E. Fein "To thy own opinions be true... *
> * kfein_at_primenet.com ..those expressed herein are but mine" *
> *******************************************************************
Hi,
The approach I would use, would be to store the arbitrarily high precision integers in VARCHAR2 fields; up to 2000 digits I believe, or else use LONGs. Then write my own SQL functions (in PL/SQL) to perform the addition, subtraction, multiplication, division, etc. I've code this problem before in 8086 assembler (about 16 years ago) and Pascal (14 years ago) using Donald Knuth's Seminumerical Algorithms (vol 2) as a reference. Refer to section on "Multiple Precision Arithmetic". Also a search of the Web should yield some solutions: I used AltaVista to search for the key words and found many references.
Hope this helps....
-- Barry P. Grove BCTEL (604)432-4468 barry_grove_at_mindlink.bc.ca Human Resources Consulting Developer, Oracle DBA, Unix Sysadmin 6-3777 Kingsway, Burnaby, BCReceived on Sat Dec 28 1996 - 00:00:00 CST
![]() |
![]() |