Re: How many pre-decimal positions/integer digits has a DECimal (5,3) defined field ?

From: Hans <forbrich_at_gmail.com>
Date: 8 Oct 2004 09:07:50 -0700
Message-ID: <bd0e88c6.0410080807.63728ec8_at_posting.google.com>


peterb_at_gmx.net (Peter Blatt) wrote in message news:<ck4ale$n5t$00$1_at_news.t-online.com>...
> Does 5 represent the total numer of digits (including the fractional portion) or only the number of places
> BEFORE the decimal point? Moreover does the number include the decimal point?
>
> Are there differences between the databases servers ?
>
> Peter

In Oracle, you would normally use the 'NUMBER(5,3)' declaration instead of 'DECIMAL(5,3)'. It results in 5 digits being stored, with the decimal place implied at position 3 - resulting in 6 'printer' positions.

In Oracle, you can also specify 'NUMBER(5,-3)' which stores 5 digits and puts the decimal 3 'zeros' after the last digit, giving you a column or variable that displays 'thousands'.

Finally, in Oracle, the traditional internal representation of a number is BCD - Binary Coded Decimal - with 2 digits per byte, up to 38 digits. Other variations, including IEEE Foating Point numerics are possible as well.

If you need more details for the Oracle side, go to http://docs.oracle.com for all online documentation, and look for the SQL Reference Manual for the version(s) of interest. Excrutiating detail is available in Chapter 1 under Datatypes.

Each RDBMS is exactly the same, only different. The 'only different' is very subtle but significant enough that a generic application can not swap out the back end without experienceing some negative impact - frequently in scalability.

HTH
/Hans

BTW: comp.databases.oracle is a dead newsgroup, carried by only a few ISPs. The question only needs to go to comp.database.oracle.misc (one of the comp.databases.oracle.* heirarchy) as described in the Charter available at http://orafaq.com Received on Fri Oct 08 2004 - 18:07:50 CEST

Original text of this message