apache/seatunnel · error · SQLException
No result returned after running query [${rowCountQuery}]
Error message
No result returned after running query [${rowCountQuery}] What it means
OracleDialect.approximateRowCntStatement runs an analyze + row-count query and reads the count from column 1. If the ResultSet has no first row, it throws this SQLException, because the chunk splitter needs an approximate row count to size splits.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleDialect.java:271
String rowCountQuery =
String.format(
"select NUM_ROWS from all_tables where OWNER = '%s' AND TABLE_NAME = '%s' ",
tablePath.getSchemaName(), tablePath.getTableName());
try (Statement stmt = connection.createStatement()) {
String analyzeTable =
String.format(
"analyze table %s compute statistics for table",
tableIdentifier(tablePath));
if (!table.getSkipAnalyze()) {
log.info("Split Chunk, approximateRowCntStatement: {}", analyzeTable);
stmt.execute(analyzeTable);
} else {
log.warn("Skip analyze, approximateRowCntStatement: {}", analyzeTable);
}
log.info("Split Chunk, approximateRowCntStatement: {}", rowCountQuery);
try (ResultSet rs = stmt.executeQuery(rowCountQuery)) {
if (!rs.next()) {
throw new SQLException(
String.format(
"No result returned after running query [%s]",
rowCountQuery));
}
return rs.getLong(1);
}
}
}
return SQLUtils.countForSubquery(connection, query);
}
@Override
public Object queryNextChunkMax(
Connection connection,
JdbcSourceTable table,
String columnName,
int chunkSize,
Object includedLowerBound)View on GitHub (pinned to cf67b549a7)
Solutions
- Run the logged rowCountQuery manually as the same Oracle user to see the actual result/error.
- Grant SELECT on the table (and stats views) to the connection user, or qualify the table with its schema owner.
- Verify the configured schema/table name and that the dialect's count statement matches your Oracle version.
- Upgrade the connector if your Oracle version changed the statement output.
Example fix
// before url = "jdbc:oracle:thin:@host:1521/ORCL" table = "MYTABLE" (owned by APP schema) // after table = "APP.MYTABLE" (or GRANT SELECT ON APP.MYTABLE TO etl_user;)
Defensive patterns
Strategy: validation
Validate before calling
// Verify the count query returns a row before running the job
try (ResultSet rs = stmt.executeQuery(rowCountQuery)) {
if (!rs.next()) throw new IllegalStateException("Oracle row-count query returned no rows for " + tableName);
} Try / catch
catch (SQLException e) { if (e.getMessage().contains("No result returned")) { /* check table visibility/privileges, retry or fall back to COUNT(*) */ } } Prevention
- Grant SELECT on the target table and stats views to the connection user
- Qualify tables with their schema owner in config
- Run the logged rowCountQuery manually against Oracle before chunked reads
When it happens
Trigger: The rowCountQuery executed against Oracle returns an empty ResultSet — e.g. the table does not exist/is not visible to the user, or the statement form is invalid on that Oracle version.
Common situations: Wrong schema/user (table lives in another schema without a synonym); missing SELECT privileges; Oracle version whose approximate-count statement form is unsupported; typo in table/database config.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No result returned after running query [${sqlQuery}]
- Failed to split chunks for table " + tableId
- oracle_insert_mode=APPEND_VALUES only supports generated INS
- No result returned after running query [%s]
- No result returned after running query [${rowCountQuery}]
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/c46afef3953a645f.
Report an issue: GitHub.