Pl/sql Number Type data _oracle

Source: Internet
Author: User
Tags commit

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;

>b
/td> a 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.