{"record":{"id":"96de2968549cbd11","repo":"apache/seatunnel","slug":"failed-to-build-the-split-data-read-statement-96de29","errorCode":null,"errorMessage":"Failed to build the split data read statement.","messagePattern":"Failed to build the split data read statement\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleUtils.java","lineNumber":343,"sourceCode":"            if (isFirstSplit) {\n                for (int i = 0; i < primaryKeyNum; i++) {\n                    statement.setObject(i + 1, splitEnd[i]);\n                    statement.setObject(i + 1 + primaryKeyNum, splitEnd[i]);\n                }\n            } else if (isLastSplit) {\n                for (int i = 0; i < primaryKeyNum; i++) {\n                    statement.setObject(i + 1, splitStart[i]);\n                }\n            } else {\n                for (int i = 0; i < primaryKeyNum; i++) {\n                    statement.setObject(i + 1, splitStart[i]);\n                    statement.setObject(i + 1 + primaryKeyNum, splitEnd[i]);\n                    statement.setObject(i + 1 + 2 * primaryKeyNum, splitEnd[i]);\n                }\n            }\n            return statement;\n        } catch (Exception e) {\n            throw new RuntimeException(\"Failed to build the split data read statement.\", e);\n        }\n    }\n\n    public static SeaTunnelRowType getSplitType(Table table) {\n        List<Column> primaryKeys = table.primaryKeyColumns();\n        if (primaryKeys.isEmpty()) {\n            throw new SeaTunnelException(\n                    String.format(\n                            \"Incremental snapshot for tables requires primary key,\"\n                                    + \" but table %s doesn't have primary key.\",\n                            table.id()));\n        }\n\n        // use first field in primary key as the split key\n        return getSplitType(primaryKeys.get(0));\n    }\n\n    /** Creates a new {@link OracleDatabaseSchema} to monitor the latest oracle database schemas. */","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleUtils.java#L325-L361","documentation":"Thrown by OracleUtils.readTableSplitDataStatement when building the JDBC PreparedStatement for reading a split's data fails with any Exception. The original exception is chained, so the cause holds the concrete problem (bad SQL, invalid parameters, connection issues).","triggerScenarios":"Constructing the split read statement failed — malformed generated SQL for the chunk range, invalid bind parameter types in splitStart/splitEnd arrays, driver rejecting the statement, or a closed/broken connection during prepareStatement.","commonSituations":"Unsupported split-column types producing invalid SQL literals/binds; primary key columns with exotic Oracle types; JDBC URL/driver version mismatch; connection dropped while preparing the statement.","solutions":["Read the chained cause exception to get the exact Oracle/JDBC error.","Check the split key types via getSplitType; switch to a simpler PK column if types are exotic.","Verify the Oracle JDBC driver version matches your Oracle server.","Check connection health (URL, wallet, firewall) if the cause is a connection error."],"exampleFix":"// before\nsplit.key = \"RAW_GUID_COL\" // unsupported bind type in chunk SQL\n// after\nsplit.key = \"ORDER_ID\" // numeric primary key","handlingStrategy":"try-catch","validationCode":"-- sanity-check the split column type before snapshot\nSELECT data_type FROM all_tab_columns WHERE owner='SCOTT' AND table_name='ORDERS' AND column_name='ORDER_ID';","typeGuard":null,"tryCatchPattern":"try {\n    PreparedStatement st = OracleUtils.readTableSplitDataStatement(jdbc, ...);\n} catch (RuntimeException e) {\n    LOG.error(\"split statement build failed: {}\", e.getCause(), e);\n    throw e;\n}","preventionTips":["Inspect the chained cause for the real JDBC/ORA error","Use standard PK types (NUMBER, VARCHAR2, DATE/TIMESTAMP) as split keys","Keep Oracle JDBC driver version aligned with the server","Validate connection settings before large snapshots"],"tags":["oracle","cdc","jdbc","statement-build"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}