The documentation states: "Precision can vary from 1 to 38. Scale can vary from -84 to 127."
How can scale be greater than accuracy? Should the scale range from -38 to 38?
The question may be, why not? Try the following SQL.
select cast(0.0001 as number(2,5)) num, to_char(cast(0.0001 as number(2,5))) cnum, dump(cast(0.0001 as number(2,5))) dmp from dual
What you see is that you can hold small numbers, it’s such a structure. It may not be required very often, but I’m sure that somewhere there is someone who stores very accurate, but very small numbers.
. , - .
select cast(0.000123 as number(2,5)) from dual
:
.00012
select cast(0.00123 as number(2,5)) from dual
select cast(0.000999 as number(2,5)) from dual
ORA-01438: value larger than specified precision allowed for this column
- .
Oracle:
, , . , . , , NUMBER (4,5), .
. . , Oracle . , Oracle .
, , :
=
= -
--this will work select cast(0.123456 as number(5,5)) from dual;
0.12346
-- but this select cast(0.123456 as number(2,5)) from dual; --will return "ORA-1438 value too large". --It will not return err with at least 5-2 = 3 zeroes: select cast(0.000123456 as number(2,5)) from dual;
0.00012
-- and of course this will work too select cast(0.0000123456 as number(2,5)) from dual;
0.00001
, , ex notation ( ). , . , , NUMBER(4,5), .
NUMBER(4,5)
Precision
NUMBER(8,5)
, Precision , Scale (, NUMBER(2, 5)), 3 :
Scale
NUMBER(2, 5)
3 . 2 ( ). , 3 + 2 = 5, Scale.
, , , NUMBER(6,9), , 9 , 3 6 .
NUMBER(6,9)
SELECT CAST(.0000123 AS NUMBER(6,9)) FROM dual; -- prints: 0.0000123; .000|012300 SELECT CAST(.000012345 AS NUMBER(6,9)) FROM dual; -- prints: 0.0000123; .000|012345 SELECT CAST(.123456 AS NUMBER(3,4)) FROM dual; -- ERROR! must have a 1 zero (4-3=1) SELECT CAST(.013579 AS NUMBER(3,4)) FROM dual; -- prints: 0.0136; max 4 digits, .013579 rounded to .0136
, , - .maximum precision of 126 binary digits, which is roughly equivalent to 38 decimal digits
maximum precision of 126 binary digits, which is roughly equivalent to 38 decimal digits
NUMBER (, ), - , - . , . (, , NUMBER (*, 10)) - , , 10
, scale , ., , , - 0,00000000123456, 100%.
scale
Source: https://habr.com/ru/post/1737600/More articles:creating gui editor - c ++Ask a question which pattern to use - design-patternsTrying to integrate Jeditable + MarkItUp and Thickbox / Lightbox - jqueryHow to start recording an existing AudioQueue in response to an event? - iphoneCreating nested arrays on the fly - javascriptgit: 'log master..origin / master' does not behave as expected - gitНужно ли останавливать Apache для редактирования "/etc/apache2/sites-available/default"? - ubuntuHow to make indexed Delphi Prism properties visible to C # when properties are not standard - c #Convert / view PowerPoint file in / in Silverlight - silverlightrequest advanced file properties using WMI - windowsAll Articles