Number (<p>,<s>)
Precision p Value Range 1~38
Valid bit S value range -84~127
Maximum number of integer digits =p-s
s positive, start rounding at specified position to right of decimal point
s minus, start rounding at specified position to the left of decimal
S is 0 or unspecified, rounded to the nearest integer
When P is less than S, the number is a number with an absolute value of less than 1, and the first s-p bit from the right of the decimal point must be 0, preserving the S-decimal.
--num_test Start------------------------------------------------
Connected to oracle9i Enterprise Edition release 9.0.1.1.1
Connected as Aspire
Sql>
Sql> SET Linesize 1000;
sql> CREATE TABLE Hjm_num_test
2 (a number,
3 b Number (5,2),
4 c Number (5,-2),
5 d Number (5,0),
6 E Number (5),
7 f Number (2,5));
Table created
Sql> INSERT into Hjm_num_test
2 (a,b,c,d,e,f) VALUES (123.3333,123.3333,123.3333,123.3333,123.3333,-0.0003);
1 row inserted
Sql> INSERT into Hjm_num_test
2 (a,b,c,d,e,f) VALUES (197.9333,197.9333,197.9333,197.9333,197.9333,0.00012567);
1 row inserted
Sql> COMMIT;
Commit Complete
Sql> SELECT * from Hjm_num_test;
/td> |
a |
| >b
c |
|
e |
f |
1 |
123.3333 |
123.33 |
100 |
123 |
123 |
-0.00030 |
2 |
197.9333 |
197.93 |
200 |
198 |
198 |
0.00013 |
(shown in Pl/sql Dev SQL window)
--num_test End--------------------------------------------------------
It seems to be the right thing to do, but now it's a problem, when I'm not running in the Pl/sql dev window and I'm running in Isqlplus, the result is a little different, notice, column F of line 1th:
A |
B |
C |
D |
E |
F |
123.3333 |
123.33 |
100 |
123 |
123 |
-.0003 |
197.9333 |
197.93 |
200 |
198 |
198 |
.00013 |
(shown in Isqlplus)
It gave up the end of the 0! The same effect is tested under Sqlplus.
However, my intention should be to retain that 0, because number (2,5) after all, it has specified a valid bit is 5 bits.