473,785 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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

Jul 19 '05 #1
6 10557
pe****@gmx.net (Peter Blatt) wrote in message news:<ck******* ******@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.o racle.misc (one
of the comp.databases. oracle.* heirarchy) as described in the Charter
available at http://orafaq.com
Jul 19 '05 #2
pe****@gmx.net (Peter Blatt) wrote in message news:<ck******* ******@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


This question is best asked in comp.databases which I added to the
list.
(but GOOGLE doesn't let me set the Follow-up: option)

IF you are asking about SQL databases, then the definition is
DECIMAL { (precision[,scale]) ]
where "precision is the total number of significant digits used to
express the number; the scale is the number of significant digits to
the right of the decimal point"

The quote is not directly from the standard. It's from SQL Instant
Reference published by SYBEX (C1993 so it is getting a little old).

For your last question, it seems database servers that claim to
support SQL would have to adhere to that definition.

HTH, both you and other readers.
Ed
Jul 19 '05 #3
pe****@gmx.net (Peter Blatt) wrote in message news:<ck******* ******@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:

5 represents total number of decimal digits, not including decimal point.
Jul 19 '05 #4
Alex Filonov wrote:
pe****@gmx.net (Peter Blatt) wrote in message
news:<ck******* ******@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?


According to the SQL standard (SQL99), subclause 4.5.1 (page 22) says:
-----------------
An exact numeric value has a precision and a scale. The precision is a
positive integer that determines the number of significant digits in a
particular radix (binary or decimal). The scale is a non-negative integer.
A scale of 0 (zero) indicates that the number is an integer. For a scale
of S, the exact numeric value is the integer value of the significant
digits multiplied by 10^(-s).
-----------------

That makes it absolutely clear that for SQL database systems the precision
(5 in the example above) is the total number of digits, including the
fractional portion and without the decimal character.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Jul 19 '05 #5
> 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.
This is why I prefer NUMERIC instead of DECIMAL.

Per ANSI SQL, for DECIMAL, the RDBMS is allowed you to give you a higher precision than you asked
for. NUMERIC is required to give you the precision you ask for.

In SQL Server, they are the same (they both gives you exactly what you ask for). But by using
NUMERIC, I would have a consistent behavior across products (assuming the other product adheres to
the ANSI SQL standard).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Hans" <fo******@gmail .com> wrote in message news:bd******** *************** ***@posting.goo gle.com... pe****@gmx.net (Peter Blatt) wrote in message news:<ck******* ******@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.o racle.misc (one
of the comp.databases. oracle.* heirarchy) as described in the Charter
available at http://orafaq.com

Jul 19 '05 #6
Yes, but page 125 states that for DECIMAL, the product can give you a higher precision than asked
for:

23) DECIMAL specifies the data type exact numeric, with the decimal scale specified by the <scale>

and the implementation-defined decimal precision equal to or greater than the value of the

specified <precision>.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Knut Stolze" <st****@de.ibm. com> wrote in message news:ck******** **@fsuj29.rz.un i-jena.de...
Alex Filonov wrote:
pe****@gmx.net (Peter Blatt) wrote in message
news:<ck******* ******@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?


According to the SQL standard (SQL99), subclause 4.5.1 (page 22) says:
-----------------
An exact numeric value has a precision and a scale. The precision is a
positive integer that determines the number of significant digits in a
particular radix (binary or decimal). The scale is a non-negative integer.
A scale of 0 (zero) indicates that the number is an integer. For a scale
of S, the exact numeric value is the integer value of the significant
digits multiplied by 10^(-s).
-----------------

That makes it absolutely clear that for SQL database systems the precision
(5 in the example above) is the total number of digits, including the
fractional portion and without the decimal character.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
10225
by: Headless | last post by:
I've marked up song lyrics with the <pre> tag because it seems the most appropriate type of markup for the type of data. This results in inefficient use of horizontal space due to UA's default rendering of <pre> in a fixed width font. To change that I'd have to specify a proportional font family, thereby falling into the size pitfall that is associated with any sort of author specified font family: a) If I specify a sans serif font...
3
3800
Pre
by: Neal | last post by:
A few questions about pre... When presenting preformatted text using the white-space: pre; property/value, Opera renders long lines at small viewport widths as exiting the borders of the element, IE6 extends the element to contain the line. Both necessitate horizontal scrolling. 1) Is one considered incorrect, or are both fair interpretations of the recommendation?
7
18536
by: Alan Illeman | last post by:
How do I set several different properties for PRE in a CSS stylesheet, rather than resorting to this: <BODY> <PRE STYLE="font-family:monospace; font-size:0.95em; width:40%; border:red 2px solid; color:red;
2
2790
by: Buck Turgidson | last post by:
I want to have a css with 2 PRE styles, one bold with large font, and another non-bold and smaller font. I am new to CSS (and not exactly an expert in HTML, for that matter). Is there a way to do this in CSS? <STYLE TYPE="text/css"> pre{ font-size:xx-large;
5
24114
by: Porthos | last post by:
I'm authoring an XML document and using the <pre> html tag for the portions that are not dynamically generated. The <pre> text is displaying in a smaller font size (and I believe different font) than standard text. I would like all of my text to be formatted this way, though I don't want to use the <pre> tag for all of it. Can anyone tell me what font and size are used by default for the <pre> tag? I don't want to change it's...
5
718
by: Michael Shell | last post by:
Greetings, Consider the XHTML document attached at the end of this post. When viewed under Firefox 1.0.5 on Linux, highlighting and pasting (into a text editor) the <pre> tag listing will preserve formatting (white space and line feeds). However, this is not true when doing the same with the <code> tag listing (it will all be pasted on one line with multiple successive spaces treated as a single space) despite the fact that...
8
3792
by: Jarno Suni not | last post by:
It seems to be invalid in HTML 4.01, but valid in XHTML 1.0. Why is there the difference? Can that pose a problem when such a XHTML document is served as text/html?
7
2751
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no tags will remain making the page safe (I have to convert the linefeeds to <BR>s because the Server.EncodeHTML does not do that it seems). The problem is that users can use a special tag when editing the top to specify an area of the tip that will...
14
3633
by: Schraalhans Keukenmeester | last post by:
I am building a default sheet for my linux-related pages. Since many linux users still rely on/prefer viewing textmode and unstyled content I try to stick to the correct html tags to pertain good readibility on browsers w/o css-support. For important notes, warnings etc I use the <pre> tag, which shows in a neat bordered box when viewed with css, and depending on its class a clarifying background-image is shown. I would like the...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.