Skip to content

Commit

Permalink
fixed error when decimal or numeric type dont have precision or scale
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioG70 authored and 006627 committed Nov 28, 2024
1 parent 80e2897 commit d6a0f67
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class SimpleTypeNumericExact extends Type {

private Integer scale;

private static final Integer SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_PRECISION = 53;
private static final Integer SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_SCALE = 10;

/**
* Exact numeric, like int or integer
*/
Expand All @@ -37,8 +40,13 @@ public SimpleTypeNumericExact() {
* the number of digits after the radix point (optional)
*/
public SimpleTypeNumericExact(Integer precision, Integer scale) {
this.precision = precision;
this.scale = scale;
if (precision == 0 && scale == 0) {
this.precision = SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_PRECISION;
this.scale = SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_SCALE;
} else {
this.precision = precision;
this.scale = scale;
}
}

/**
Expand Down

0 comments on commit d6a0f67

Please sign in to comment.