{"record":{"id":"d25adcf7de24bae3","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-d25adc","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/db2/DB2TypeConverter.java","lineNumber":295,"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":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java#L277-L313","documentation":"Decimal scale in DB2 must be >= 0. If reconvert encounters a DecimalType with negative scale (or a scale left negative after precision clamping), it sets scale to 0 and logs this warning, converting the type to decimal(p,0). Negative scale is not representable in DB2 DECIMAL.","triggerScenarios":"reconvert gets a column with scale < 0, e.g. from sources that model DECIMAL(p,-s) (Oracle-style negative scale) or as a side effect of the precision-shrink formula scale - (precision - MAX_PRECISION).","commonSituations":"Migrating from Oracle where NUMBER(p,-2) style negative scale exists; precision clamping of very wide decimals pushing scale negative; programmatic schemas with negative scale values.","solutions":["Change the column to non-negative scale at the source or via a transform cast (e.g. ROUND to integer scale 0)","Explicitly define the sink schema with scale 0 for that column","If coming from precision clamping, reduce source precision so scale stays non-negative","Verify the source dialect's type mapper isn't emitting negative scales erroneously"],"exampleFix":"// before\nDECIMAL(10, -2)\n// after\nDECIMAL(10, 0)","handlingStrategy":"validation","validationCode":"// before write\nDecimalType dt = (DecimalType) column.getDataType();\nif (dt.getScale() < 0) {\n    throw new IllegalArgumentException(\"Column \" + column.getName() + \" has negative decimal scale \" + dt.getScale());\n}","typeGuard":"boolean hasNonNegativeScale(DecimalType dt) {\n    return dt.getScale() >= 0;\n}","tryCatchPattern":null,"preventionTips":["Convert Oracle-style negative scales (NUMBER(p,-s)) before syncing to DB2","After precision clamping, re-check scale >= 0 in your schema validation","Round to scale 0 explicitly when integer representation is intended"],"tags":["jdbc","db2","decimal","scale"],"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-14T05:17:10.506Z"}