Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8

    Question Unanswered: NUMBER vs. NUMBER(18)

    I have a lot of FK constraints with nonmatching column definitions, resulting from some columns being a NUMBER and some being NUMBER(18). All are supposed to be NUMBER(18) (I have no idea why 18 was picked as the magic number).

    So basically, I'd like them all to be NUMBER(18), however, I of course can't alter the columns from NUMBER to NUMBER(18) because I can't decrease precision on a non-emtpy column. I can go the other way and make everything a NUMBER, but a NUMBER is floating-point, and I just need an integer. So my question is this: Is there any disadvantage to making everything a NUMBER rather than a NUMBER(18) (i.e. slower joins for floating point vs. integer etc)?

    Thanks!

  2. #2
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    Hi,

    A column declared to be of type NUMBER(18) will not store any decimals at all. For Examole, the number 49309.593 stored in a column defined in this way will appear as 49310, because Oracle automatically rounds up in cases where the value in the precision area that the declared datatype will not support is 5 or above.
    SATHISH .

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8
    Originally posted by satish_ct
    Hi,

    A column declared to be of type NUMBER(18) will not store any decimals at all. For Examole, the number 49309.593 stored in a column defined in this way will appear as 49310, because Oracle automatically rounds up in cases where the value in the precision area that the declared datatype will not support is 5 or above.
    Thanks, but what I was wondering was if there was a disadvantage to having something be a floating-point NUMBER vs. an integer NUMBER(18) when an integer is all that is needed.

  4. #4
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    Hi,

    Sure there will be some disadvantage, to have something be a floating-point NUMBER vs. an integer NUMBER(18) when an integer is all that is needed.

    1. First thing is Memory. Suppose if the number to be stored is 4756.
    In the floating point , it'll be stored as NUMBER(6,2). As an INTEGER
    it'll be stored as NUMBER(4).

    2. Since the INTEGER is all that is needed, U can retrieve the precision
    values. So there's no meaning in storing them as Floating-Point.
    SATHISH .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •