My NestJS API connects to an Oracle database and executes search queries using bind parameters.
The problem is that running the same search multiple times through the NestJS API sometimes returns inconsistent/different records.
However, if I execute the same SQL directly using an Oracle client on Windows, against the same database and with the same filter values, the results are consistent.
const result = await connection.execute( sql,
{
premType0: premType,
spType0: spType,
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
return result.rows;
Initially I suspected the ORDER BY combined with:FETCH FIRST 300 ROWS ONLY
so I added additional columns to make the ordering deterministic. I also tested moving DISTINCT before the row limit. However, the inconsistent behavior through the NestJS API still occurs.
The issue is not reproducible when running the equivalent query directly from the Oracle client.
What differences between a node-oracledb 6.10.0 connection/session and an Oracle client session could cause the same SQL and bind values to return different result sets?
Should I specifically investigate:
connection pooling/session reuse
Oracle service or RAC instance differences
bind variable types
transaction/isolation settings
Thin vs Thick mode
session-specific Oracle settings
What would be the best way to identify the difference between the NestJS execution and the Oracle client execution?