开发者

How to get oracle query status in Pro*C?

My code runs oracle select query on a server. The server may be free or it may be busy at certain times.Now what I am making is a timeout mechanism in Pro*C that times out after 10 seconds and cancels the thread that was running oracle query (if it is still running).

Now, the problem which I'm facing is that the timeout function is scheduled to terminate the threads after 10 seconds, and it does so very well. However it is not able to make out whether the oracle query was still in waiting state at the time of termination or it was returning results/executing procedure/blah-blah...

What I want is a function/mechanism/anything that would be able to query the status of the oracle query initiated and act as following: after 10 seconds,

开发者_JAVA技巧
IF (query is still in waiting state)
    DO terminate all threads;
ELSE IF (query is fetching data/doing some processing)
    DO wait for the fetching/processing to complete and then terminate all threads;

A Pro*C or Oracle function call would be the best option instead of using complex code, if possible.


What does "fetching data/ doing some processing" mean to you? In general, since Oracle executes the query as the application fetches data, a query will alternate between actively running (which would involve being in a wait state) and returning data to the client. If you are sending 50 rows at a time to the client, for example, Oracle only executes the query far enough to identify the first 50 rows, it sends those rows to the client, and it waits for the client to request the next 50 rows before continuing to execute the query to pull the next 50 rows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜