{"record":{"id":"232e8fe73b5cbcbb","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-232e8f","errorCode":null,"errorMessage":"The decimal column {} type decimal({},{}) is out of range, which is scale less than 0, it will be converted to decimal({},{})","messagePattern":"The decimal column (.+?) type decimal\\((.+?),(.+?)\\) is out of range, which is scale less than 0, it will be converted to decimal\\((.+?),(.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerTypeConverter.java","lineNumber":379,"sourceCode":"                            precision,\n                            scale);\n                } else if (precision > MAX_PRECISION) {\n                    scale = (int) Math.max(0, scale - (precision - MAX_PRECISION));\n                    precision = MAX_PRECISION;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which exceeds the maximum precision of {}, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            MAX_PRECISION,\n                            precision,\n                            scale);\n                }\n                if (scale < 0) {\n                    scale = 0;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which is scale less than 0, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            precision,\n                            scale);\n                } else if (scale > MAX_SCALE) {\n                    scale = MAX_SCALE;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which exceeds the maximum scale of {}, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            MAX_SCALE,","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerTypeConverter.java#L361-L397","documentation":"WARN logged by SqlServerTypeConverter.reconvert when a DECIMAL column has a negative scale; the scale is clamped to zero and the adjusted decimal(precision,scale) is emitted in the SQL Server DDL. Type-adjustment warning only.","triggerScenarios":"reconvert encounters DecimalType with scale < 0 — possible when upstream type inference or config yields negative scale (some engines allow negative scale, e.g. Oracle NUMBER(p,-s)).","commonSituations":"Migrating from Oracle NUMBER with negative scale, or schemas constructed programmatically with negative scale values.","solutions":["Set the column scale to >= 0 in the schema (e.g. decimal(18,0)).","If negative-scale semantics (rounding to hundreds/thousands) matter, pre-round the values in a transform and use scale 0.","Ignore the warning if scale 0 output is acceptable."],"exampleFix":"// before\nfield = { name = \"qty\", type = \"decimal(10,-2)\" }\n// after\nfield = { name = \"qty\", type = \"decimal(10,0)\" }","handlingStrategy":"validation","validationCode":"if (dt.getScale() < 0) throw new IllegalArgumentException(\"decimal scale must be >= 0 for column \" + col.getName());","typeGuard":"boolean hasNonNegativeScale(DecimalType dt) { return dt.getScale() >= 0; }","tryCatchPattern":null,"preventionTips":["Avoid Oracle-style negative-scale NUMBER columns; pre-round instead","Set explicit decimal(x,0) for integer-like decimals","Normalize schemas before migration"],"tags":["jdbc","sqlserver","decimal","type-conversion"],"backgroundTag":"value-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}