decimal(38,0)
Posted in 2012
Topics: General Discussion
IDS 11.70.fc3 It appears that decimal can't be more than decimal(32,0) what are my choices for this column? thanks ..... Peter Logan Senior Database Administrator Phone: 616/878-8309
On Wed, Feb 29, 2012 at 08:50, Peter_Logan@spartanstores.com < Peter_Logan@spartanstores.com> wrote: > IDS 11.70.fc3 > > It appears that decimal can't be more than decimal(32,0) what are my > choices for this column? > Does the data actually use the 33rd-38th digits? If not, go with DECIMAL(32). Note that DECIMAL(32,0) is for 32-digit integers; DECIMAL(32) is a 32-digit floating point number (except in a MODE ANSI database, where it is an integer again). Failing that, either CHAR(38) or VARCHAR(38), or if you need signs and decimal points, then CHAR(40) or VARCHAR(4), or if you need up to 3 digits of exponent, then CHAR(45) or VARCHAR(45). What do you have with more than 32 digits in the numbers? Is this an ID number of some sort? -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." --f46d04016971c221da04ba1d3669
It's coming from and Oracle database ... and it's a transaction id .. I'll just go with char .... Thanks ... Peter Logan Senior Database Administrator Phone: 616/878-8309 From: "Jonathan Leffler" <jonathan.leffler@gmail.com> To: ids@iiug.org Date: 02/29/2012 11:57 AM Subject: Re: decimal(38,0) [26398] Sent by: ids-bounces@iiug.org On Wed, Feb 29, 2012 at 08:50, Peter_Logan@spartanstores.com < Peter_Logan@spartanstores.com> wrote: > IDS 11.70.fc3 > > It appears that decimal can't be more than decimal(32,0) what are my > choices for this column? > Does the data actually use the 33rd-38th digits? If not, go with DECIMAL(32). Note that DECIMAL(32,0) is for 32-digit integers; DECIMAL(32) is a 32-digit floating point number (except in a MODE ANSI database, where it is an integer again). Failing that, either CHAR(38) or VARCHAR(38), or if you need signs and decimal points, then CHAR(40) or VARCHAR(4), or if you need up to 3 digits of exponent, then CHAR(45) or VARCHAR(45). What do you have with more than 32 digits in the numbers? Is this an ID number of some sort? -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." --f46d04016971c221da04ba1d3669 ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum.
You can use decimal(32) which allows for 32 significant digits. Specifying the precision is optional. If you use DECIMAL(32) a floating-point decimal with a precision of 32 places. DECIMAL ( X ) has an absolule exponent range between 10 ^ - 130 and 10 ^ 124. John F. Miller III STSM, Embedability Architect miller3@us.ibm.com 503-578-5645 IBM Informix Dynamic Server (IDS) (Embedded image moved to file: pic08027.gif) ids-bounces@iiug.org wrote on 02/29/2012 08:50:09 AM: > From: "Peter_Logan@spartanstores.com" <Peter_Logan@spartanstores.com> > To: ids@iiug.org > Date: 02/29/2012 09:00 AM > Subject: decimal(38,0) [26395] > Sent by: ids-bounces@iiug.org > > IDS 11.70.fc3 > > It appears that decimal can't be more than decimal(32,0) what are my > choices for this column? > > thanks ..... > > Peter Logan > Senior Database Administrator > Phone: 616/878-8309 > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. >
Correct, DECIMAL supports up to 32 decimal digits of precision. Even BIGINT only support 18+ digits and DOUBLE only supports about 15+ digits, so you will have either use a CHAR(38) column in the table and process the values in code using some high precision math library like the GNU MP Arbitrary Precision Arithmetic library. You could create a UDT using the GNU MP library so you can create an arbitrary precision data type. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Wed, Feb 29, 2012 at 11:50 AM, Peter_Logan@spartanstores.com < Peter_Logan@spartanstores.com> wrote: > IDS 11.70.fc3 > > It appears that decimal can't be more than decimal(32,0) what are my > choices for this column? > > thanks ..... > > Peter Logan > Senior Database Administrator > Phone: 616/878-8309 > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --14dae9340cbd01a96004ba1e3d27