Reputation: 21329
What does :
value_1 INTEGER(5);
mean ?
I understand that value_1
is an integer but what does 5
mean in the declaration ?
Upvotes: 4
Views: 1856
Reputation: 1087
In simple term when someone write something like value_1 INTEGER(5); means defining a number type of variable with name value_1 and the Precision of that number type is 5.
In addition to precision one can also define a scale like this : value_1 number(p,s) --where p is the precision and s is the scale.
In Oracle 11g - Precision can range from 1 to 38 and Scale can range from -84 to 127.
For example, number(7,2) is a number that has 5 digits before the decimal and 2 digits after the decimal.
Now suppose you want to define a number which should always <1000 then you can define like this :
NUMBER(3,2) so that you can accomodate max 999.99
Hope this is helpful !!
Upvotes: 2
Reputation: 23747
In Oracle this means maximal number of decimal digits allowable for number to have.
So, variable of type number(5) can contain 99999, but not 100000.
In fact, that subtype limits you to values -99999 to 99999.
Oracle docs covering number
subtypes, of which one is integer
.
Oracle docs covering the number
type.
Upvotes: 6