Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Query timeout
"ReplyToGroups" <sorry_at_NoAddress.com> wrote in message
news:bpl25e$4jj2_at_eccws12.dearborn.ford.com...
> Hi
>
> Is there anyway I can break the long running query after 'x' minutes. I
> wanted to do this in procedure.
> Let's say if the query runs more than 2 minutes then I wanted to Exit the
> procedure and send the message to the user.
Yes you can do this if you use OCI. Set up a server connection in nonblocking mode. Then execute your query, while setting an alarm in your C code to check for completion of the query (by executing the same statement with the same parameters) after a certain period of time. If, after checking for n times (representing your query timeout period), the status returned is still OCI_STILL_EXECUTING, then you can issue an OCIBreak() and then an OCIReset() to cancel the call.
Read about nonblocking mode server connection here:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96584/oci02bas.htm#446515
Read about how to cancel a nonblocking call here:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96584/oci02bas.htm#446558
HTH,
Dave
>
> Thanks
> Sync
>
>
Received on Sat Nov 22 2003 - 01:01:29 CST