Hi!
I'm writting a multithread application.
I have a control thread, which creates and starts several threads. These threads create OracleSessions, OracleDataSets and query data. The control thread should wait all threads, until they finished or timeout.

How to properly break execution, if query is running longer when timeout value?


You can call TOracleSession.BreakExecution:
[quote]TOracleSession.BreakExecution

Declaration
procedure BreakExecution;

Description
Breaks the execution of the currently running query in this session, resulting in error "ORA-01013, user requested cancel of current operation". It can be used in multi-threaded applications to abort long running queries on the server.[/quote]
Thanks for your reply, Marco!

1. Does it break execution immediatly or I need wait for some time?
2. How I can get information that I have running queries at the current moment?
1. It sends a break signal to the Oracle Server for the given session. The query that is executing will then terminate with an "ORA-01013, user requested cancel of current operation" exception. Because the break call and the query are running in different threads, this will be asynchronous and there will be some delay due to Oracle Server processing.

2. This information is not available as a TOracleSession property. You would need to inspect your applications TThread status.
© Allround Automations forums