Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 300047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:52:43+00:00 2026-05-12T06:52:43+00:00

Is there any benefit to specifying the precision on the PK? Is 7,0 sufficient,

  • 0

Is there any benefit to specifying the precision on the PK? Is 7,0 sufficient, given that there will probably never be more than a few thousand records?

Any dangers to not specifying the precision?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:52:43+00:00Added an answer on May 12, 2026 at 6:52 am

    NUMBER(7, 0) just constrains the domain of values.

    Their internal represenations do not differ:

    CREATE TABLE t_pk (col1 NUMBER(7, 0) NOT NULL, col2 NUMBER(38) NOT NULL)
    
    INSERT
    INTO    t_pk
    VALUES  (9999999, 9999999)
    
    SELECT  DUMP(col1), DUMP(col2)
    FROM    t_pk
    
    DUMP(col1)                        DUMP(col2)
    ---                               ---
    Typ=2 Len=5: 196,10,100,100,100   Typ=2 Len=5: 196,10,100,100,100
    

    In Oracle, the NUMBERs are stored as centesimal digits of the numeric value normalized to 0.01 <= N < 1 and prepended with the exponent.

    In the example above:

    • 196 is the 192-based exponent (4).
    • 10 is decimal 9
    • 100‘s are decimal 99‘s

    The whole number reads in decimal as 00.09 99 99 99 * (100 ^ 4) = 9,999,999

    The more digits are required to satisfy the precision requested, the more of them will be stored of course.

    When you insert a precise value into a less precise column, it just gets rounded to column’s precision and is stored rounded.

    Therefore, it is safe performance-wise to declare you column NUMBER(38), since it implies no overhead over NUMBER(7, 0) (for the numbers that fit both types).

    However, if your PRIMARY KEYs are integer by nature, you better specify precision as 0 to make sure no fractional value ever gets to your table.

    Update:

    @Mac also pointed that the clients may rely on the column datatype to figure out the values domain.

    If your application expects an INT32, you should make your number a NUMBER(9) or below (or whatever type your client considers to be convertable to Int32).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any benefit in having never-defined structures in C ? Example in SQLite
In C++, is there any benefit to using long over int? It seems that
Are there any more generic tools that can compile or basically merge multiple PHP
Is there any benefit to include the length specifier in a format string for
I there any benefit to putting the javascript references in individual pages vs the
Is there any benefit (or conversely, cost) to passing a parameter by const value
When using Google app engine is there any benefit to use a CDN if
Possible Duplicate: C# member variable initialization; best practice? Is there any benefit to this:
Is there any performance benefit/technical differences between calling EF SaveChanges() in a foreach loop
Are there any benefit in me drawing my own buttons (just rectangles) over loading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.