{"record":{"id":"2f921ccfe7433bdb","repo":"apache/seatunnel","slug":"no-result-returned-after-running-query-sqlquery","errorCode":null,"errorMessage":"No result returned after running query [${sqlQuery}]","messagePattern":"No result returned after running query \\[(.+?)\\]","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleDialect.java","lineNumber":324,"sourceCode":"            sqlQuery =\n                    String.format(\n                            \"SELECT MAX(%s) FROM (\"\n                                    + \"SELECT %s FROM %s WHERE %s >= ? ORDER BY %s ASC \"\n                                    + \") WHERE ROWNUM <= %s\",\n                            quotedColumn,\n                            quotedColumn,\n                            tableIdentifier(table.getTablePath()),\n                            quotedColumn,\n                            quotedColumn,\n                            chunkSize);\n        }\n\n        try (PreparedStatement ps = connection.prepareStatement(sqlQuery)) {\n            ps.setObject(1, includedLowerBound);\n            try (ResultSet rs = ps.executeQuery()) {\n                if (!rs.next()) {\n                    // this should never happen\n                    throw new SQLException(\n                            String.format(\"No result returned after running query [%s]\", sqlQuery));\n                }\n                return rs.getObject(1);\n            }\n        }\n    }\n\n    @Override\n    public Object[] sampleDataFromColumn(\n            Connection connection,\n            JdbcSourceTable table,\n            String columnName,\n            int samplingRate,\n            int fetchSize)\n            throws Exception {\n        String sampleQuery;\n        if (StringUtils.isNotBlank(table.getQuery())) {\n            sampleQuery =","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleDialect.java#L306-L342","documentation":"OracleDialect.queryNextChunkMax executes a query with the chunk's lower bound to fetch the next max value used for split ranges. An empty ResultSet throws this SQLException with the comment 'this should never happen', meaning the split-range invariant (at least one row at/after the lower bound) was violated.","triggerScenarios":"The prepared sqlQuery with bound includedLowerBound returns no rows — the data the split enumerator expected was deleted/changed (e.g. table truncated or rows removed) between split enumeration and chunk-max querying, or the lower bound is inconsistent with the data.","commonSituations":"Concurrent DELETE/TRUNCATE on the Oracle table during split computation; table statistics badly stale so the enumerator assumed rows that don't exist; partition pruning mismatch.","solutions":["Re-run the job — a transient concurrent modification usually resolves on retry.","Avoid truncating/heavily deleting data while the job computes splits.","Refresh Oracle table statistics (DBMS_STATS) so split bounds match real data.","Check the logged sqlQuery and bound values against the table to find why no row satisfies the predicate."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (SQLException e) { if (e.getMessage().contains(\"No result returned\")) { /* re-enumerate splits and retry once; else fail job with concurrent-modification context */ } }","preventionTips":["Do not truncate/bulk-delete rows while a chunked read job is computing splits","Keep Oracle statistics fresh (DBMS_STATS) so split bounds match data","Retry transient failures from concurrent data modification"],"tags":["jdbc","oracle","sql","chunk-splitting"],"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"}