I am writing a small program for Testing purpose , in that my requirement is to write a query that takes more than 2 minutes to execute .Right now i have only a small Table called as "Users" with very less data .
Please let me know how can i achieve this thing ??
Basically i am testing as that ,, if the query takes more than 2 Minutes to execute , i need to stop executing it and display an Error Page in JSP (J2EE )
So please tell me , how can i achieve this . Thanks in advance .
how can i use
dbms_lock.sleep(120) with a basic query as "Select Names from Users" .
How do you stop it? The only dependable way I know is to implement query timeouts in the database itself (particularly as you appear to be using Oracle) - in which case why test it?
If you want to have the client try to cancel a long running query (which might not work) you could test it by writing a query that opens a cursor that loops forever.
dbms_lock.sleep(120) with a basic query as "Select Names from Users" .
You can wrap dbms_lock.sleep in a function:
This message was edited 2 times. Last update was at by Ireneusz Kordal
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
This is the wrong approach to take.
Your goal is to test the response of a query taking too long--don't actually *make* the query, plug in a service implementation that simulates a long-running query.
subject: How to write a query that takes more than 2 minutes to execute