{"record":{"id":"f8a7a96fc5de7351","repo":"apache/seatunnel","slug":"no-result-returned-after-running-query-s-f8a7a9","errorCode":null,"errorMessage":"No result returned after running query [%s]","messagePattern":"No result returned after running query \\[(.+?)\\]","errorType":"exception","errorClass":"SQLException","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":76,"sourceCode":"@Slf4j\npublic class OracleUtils {\n\n    private static final int DEFAULT_FETCH_SIZE = 1024;\n\n    private OracleUtils() {}\n\n    public static Object[] queryMinMax(JdbcConnection jdbc, TableId tableId, String columnName)\n            throws SQLException {\n        final String minMaxQuery =\n                String.format(\n                        \"SELECT MIN(%s), MAX(%s) FROM %s\",\n                        quote(columnName), quote(columnName), quoteSchemaAndTable(tableId));\n        return jdbc.queryAndMap(\n                minMaxQuery,\n                rs -> {\n                    if (!rs.next()) {\n                        // this should never happen\n                        throw new SQLException(\n                                String.format(\n                                        \"No result returned after running query [%s]\",\n                                        minMaxQuery));\n                    }\n                    return SourceRecordUtils.rowToArray(rs, 2);\n                });\n    }\n\n    public static long queryApproximateRowCnt(\n            OracleSourceConfig oracleSourceConfig, JdbcConnection jdbc, TableId tableId)\n            throws SQLException {\n        Boolean useSelectCount = oracleSourceConfig.getUseSelectCount();\n        String rowCountQuery;\n        if (useSelectCount) {\n            rowCountQuery = String.format(\"select count(*) from %s\", quoteSchemaAndTable(tableId));\n        } else {\n            rowCountQuery =\n                    String.format(","sourceCodeStart":58,"sourceCodeEnd":94,"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#L58-L94","documentation":"Thrown by OracleUtils.queryMinMax when the MIN/MAX query over a split column returns an empty ResultSet. The code treats this as an invariant violation ('this should never happen') because snapshotting only runs on tables expected to contain at least one row for the split key.","triggerScenarios":"The split-key MIN/MAX SELECT ran but returned zero rows — the table (or filtered subset) is empty, or the rows were deleted between chunk planning and this query.","commonSituations":"Incremental snapshot configured on an empty table; table truncated concurrently during snapshot startup; overly restrictive filter leaving no rows; wrong split key column causing no matching rows.","solutions":["Ensure the table has at least one row before starting incremental snapshot, or skip empty tables in tableList.","Check for concurrent truncation/delete jobs interfering with snapshot startup.","Verify the split key column name resolves to a real populated column.","If empty tables are expected, upgrade connector version or handle empty tables before enabling incremental snapshot."],"exampleFix":"// before\n-- table ORDERS is empty, snapshot fails\nDELETE FROM staging; -- concurrent truncate during startup\n// after\nINSERT seed rows or exclude the empty table from tableList until it has data","handlingStrategy":"validation","validationCode":"-- ensure the split table has rows before snapshot\nSELECT COUNT(*) FROM scott.orders;","typeGuard":null,"tryCatchPattern":"try {\n    Object[] minMax = OracleUtils.queryMinMax(jdbc, tableId, columnName);\n} catch (SQLException e) {\n    LOG.error(\"empty MIN/MAX result for {}.{}, table may be empty\", tableId, columnName, e);\n}","preventionTips":["Exclude empty tables from tableList or seed rows first","Avoid concurrent truncate/delete during snapshot startup","Verify the split column name resolves correctly"],"tags":["oracle","cdc","jdbc","empty-result"],"backgroundTag":"empty-result-set","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"}