-4

Can anyone clarify what datatype NUMBER(12,0) means in S_NO NUMBER(12,0) NOT NULL ENABLE PRIMARY KEY?

Please clarify each parameter (i.e. 12,0).

J0e3gan
  • 8,740
  • 10
  • 53
  • 80
sam
  • 1
  • 1
  • 4
  • 2
    Reading the fine manual - Database SQL Language Reference: [Data types](https://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements001.htm#SQLRF0021) ? – user272735 Jan 15 '16 at 05:14

1 Answers1

1

NUMBER(12,0) indicates a numeric data type with precision 12 and scale 0.

A related SO post explains precision and scale further:

Precision is the number of significant digits. Oracle guarantees the portability of numbers with precision ranging from 1 to 38.

Scale is the number of digits to the right (positive) or left (negative) of the decimal point. The scale can range from -84 to 127.

Applying this explanation to your case, the maximum number that NUMBER(12,0) could store would be 999999999999 (i.e. 12 significant digits with no digits to the right or left of the decimal point).

There are many other supporting explanations of Oracle's numeric data types, precision, and scale online too, including a good one from Oracle FAQ.

Community
  • 1
  • 1
J0e3gan
  • 8,740
  • 10
  • 53
  • 80
  • are you able to clarify it or not? – sam Jan 15 '16 at 04:50
  • ok what is diffrence between TIMESTAMP(6) and TIMESTAMP(4),TIMESTAMP(5) – sam Jan 15 '16 at 05:07
  • 2
    @sam: Not to be rude, but **a)** a search goes a long way (e.g. http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm#i1006050), **b)** your comment adds a different question to your original question, and **c)** this is classic [help vampirism](http://meta.stackoverflow.com/q/258206/1810429?stw=2) (not a good thing). – J0e3gan Jan 15 '16 at 05:15
  • @J0e3gan - if the OP won't read the manual it's unlikely they'll read a piece on StackOverflow etiquette. More's the pity. – APC Jan 16 '16 at 14:10