A stored procedure through PROP:SQL returns in milliseconds but the same script in the admin tool takes much longer

Applies to: a 2014 thread; Clarion version not named. As reported, MS SQL; Oracle (OCI) and ODBC are mentioned in passing.

Problem

A VIEW's PROP:SQL calling a stored procedure gave control back after a few milliseconds. The same script run in a database admin tool lasted much longer. The poster asked whether multi-row results can still be arriving after the call returns, before the loop of NEXT calls starts.

Solution

  1. Yes, it can happen. On MS SQL the server may read part of the result set into the cursor, return to the caller, and load the rest on another thread so the caller can start scrolling early. When this happens is decided by the server (indexes, size, threshold values and more).
  2. Other back ends may do something similar; check the ODBC documentation, or the OCI documentation for Oracle.
  3. If the timings differ a lot, first make sure both sides return the same result set, then look at what else the management tool does. Large differences usually point to something else.
  4. A second poster added that the reply data from the call is complete, that the server generally sends the whole result set at once, and that NEXT reads from records buffered in the file driver cache.

Caveats

  • The two replies differ on how the result set arrives (loaded in the background versus all at once). The thread did not measure either.
  • Same second poster: running calls in a tight loop is a bad idea; use a window timer, because overrunning Windows "helper" threads can slow it badly. This was advice, not measured.
  • The original poster accepted both answers; no test was reported.

Today (2026)

Not re-tested. Likely still a fair description of server-side cursors in general; verify on your server.

Sources: Darko (Feb 2014, the question), Dennis E., Carl S. (Feb 2014) in softvelocity.clarion.databasedrivers.