Class NumericRangeRefusal
CAST(1000 AS NUMBER(2,0)) Number out of representable range: type FIXED[SB2](2,0){not null}, value 1000
CAST(1 AS NUMBER(0,0)) Number out of representable range: type FIXED[SB1]{not null}, value 1
CAST(PARSE_JSON('1000') AS NUMBER(2,0)) Number out of representable range: type FIXED, value 1000
CAST('1000' AS NUMBER(2,0)) Numeric value '1000' is out of range
★ THE WIDTH IS OMITTED AT PRECISION ZERO and printed everywhere else — NUMBER(0,0) reads
FIXED[SB1]{not null} with no parentheses at all. A VARIANT source drops the class AND the width,
keeping the bare family name.
★ THE NULLABILITY IS PART OF THE TYPE, and it is read from where the number was GOING or coming
FROM rather than from the number: a literal is not null, a nullable column nullable.
★ THE CLASS FOLLOWS THE VALUE ON EVERY PATH BUT ONE. A cast, an INSERT … SELECT, an UPDATE
and a MERGE all tag the VALUE that would not fit (SignedStorageWidth.tagOf(java.lang.Object, int)); only
INSERT … VALUES tags the COLUMN's own slot (SignedStorageWidth.tagOfPrecision(int)), which
is what makes the two spellings of one write disagree: a 10^11 written into a NUMBER(2,0) reads SB1
through VALUES and SB8 through SET. An approximate (FLOAT) source tags the slot too — there is no
unscaled integer to measure.
The whole family is ROW-TIME: over an empty table the same conversion refuses nothing, on both engines, so none of these sentences carries a compilation prefix or a position.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanexceeds(BigDecimal value, int precision, int scale) Whethervalueneeds more digits left of the point than a NUMBER(precision,scale) has room for.static StringgText(double value) A double in live's overflow-value spelling: six significant digits, trailing zeros dropped, lowercaseewith a signed exponent —3e+38,1.5e+39,1.70141e+38.static booleanWhether a raw scaled integer is outside the signed 128-bit carrier.static booleanpastEveryNumber(BigDecimal value, int scale) Whether a value is past what EVERY exact number can hold, taken atscalethe wayexceeds(java.math.BigDecimal, int, int)takes it — so a string of decimals that merely rounds away stays readable ('0.999…9'with thirty-nine decimals is 1, not an overflow).static Stringtyped(String storageTag, int precision, int scale, boolean nullable, BigDecimal value) The full sentence: storage class, declared width, nullability, value.static StringtypedDouble(String storageTag, int precision, int scale, boolean nullable, BigDecimal value) The sentence with the value printed as a DOUBLE in live's six-significant-digit scientific form — the render every raw-integer and quotient overflow uses, even when the digits would fit the carrier (live-verified: a quotient of 1.11…e38 prints1.11111e+38, not its digits).static StringThe typed sentence with the value's text supplied by the caller — for the refusals whose value live prints at its own scale, trailing zeros and all, rather than stripped.static StringunconvertibleText(Object text) The sentence a STRING source gets — a different family, naming the text rather than the type.static StringunreadableText(Object text) The sentence a STRING earns when its value needs more digits than ANY number holds, which live treats as a failure to READ the text rather than a complaint about where it was going:static Stringuntyped(BigDecimal value) The sentence a VARIANT source gets: the family alone, with neither class nor width.static StringvalueText(BigDecimal value) The value as live prints it: its own digits with trailing zeros dropped, so a 1000.00 that failed a NUMBER(2,0) reads1000while a 12.399 that failed a NUMBER(3,2) keeps all of12.399— the number as WRITTEN, not as the destination would have rounded it.
-
Method Details
-
typed
public static String typed(String storageTag, int precision, int scale, boolean nullable, BigDecimal value) The full sentence: storage class, declared width, nullability, value. -
typedText
public static String typedText(String storageTag, int precision, int scale, boolean nullable, String valueText) The typed sentence with the value's text supplied by the caller — for the refusals whose value live prints at its own scale, trailing zeros and all, rather than stripped.- Parameters:
storageTag- the SBn tagprecision- the declared precision, or 0 for an untyped carrierscale- the declared scalenullable- whether the carrier is nullablevalueText- the value exactly as the sentence prints it- Returns:
- the sentence
-
typedDouble
public static String typedDouble(String storageTag, int precision, int scale, boolean nullable, BigDecimal value) The sentence with the value printed as a DOUBLE in live's six-significant-digit scientific form — the render every raw-integer and quotient overflow uses, even when the digits would fit the carrier (live-verified: a quotient of 1.11…e38 prints1.11111e+38, not its digits). -
outsideSb16Window
Whether a raw scaled integer is outside the signed 128-bit carrier. The bound is two's-complement ASYMMETRIC on purpose: -2^127 itself is representable and live answers it (live-verified), while +2^127 is the first refusal on the positive side. -
gText
A double in live's overflow-value spelling: six significant digits, trailing zeros dropped, lowercaseewith a signed exponent —3e+38,1.5e+39,1.70141e+38. -
untyped
The sentence a VARIANT source gets: the family alone, with neither class nor width. -
unconvertibleText
The sentence a STRING source gets — a different family, naming the text rather than the type. -
unreadableText
The sentence a STRING earns when its value needs more digits than ANY number holds, which live treats as a failure to READ the text rather than a complaint about where it was going:'123456789012'::NUMBER(10,0) is out of range fits a NUMBER, not THIS one '999…9'(39)::NUMBER(10,0) is not recognized fits no NUMBER at all '999…9'(39)::NUMBER(38,0) is not recognized …the target makes no difference
The text is echoed exactly as written — live keeps its leading zeros, its sign and its fraction — and the TRY_ spellings answer NULL for both sentences.
- Parameters:
text- the source text- Returns:
- the sentence
-
pastEveryNumber
Whether a value is past what EVERY exact number can hold, taken atscalethe wayexceeds(java.math.BigDecimal, int, int)takes it — so a string of decimals that merely rounds away stays readable ('0.999…9'with thirty-nine decimals is 1, not an overflow).- Parameters:
value- the parsed valuescale- the scale it is being read at- Returns:
- whether no NUMBER could hold it
-
exceeds
Whethervalueneeds more digits left of the point than a NUMBER(precision,scale) has room for. The value is taken at the TARGET's scale first, so a number that merely carries extra fractional digits rounds into range instead of overflowing. -
valueText
The value as live prints it: its own digits with trailing zeros dropped, so a 1000.00 that failed a NUMBER(2,0) reads1000while a 12.399 that failed a NUMBER(3,2) keeps all of12.399— the number as WRITTEN, not as the destination would have rounded it.
-