I would like to use Oracle SQL Developer to execute a stored procedure asynchronously a large number of times.
Pseudo Code
var pStatus number
var pOraErrCd varchar2
var pOraErrMsg varchar2
for i 1 .. 1000 -- do async
loop
exec myproc('test',:pStatus ,:pOraErrCd ,:pOraErrMsg);
end loop;
The stored procedure's purpose is to do some inserts. For testing I just want to execute the stored procedure asynchronously a large number of times. I don't care about any return values.
Is there a "easy" way to do this?
Since you want to simulate N sessions each calling the procedure 1000/N times, I would probably do something like
This example will start 10 sessions each of which will execute the procedure 100 times in quick succession assuming your database's
JOB_QUEUE_PROCESSES
is at least 10 meaning that Oracle is allowed to have 10 jobs running in the background simultaneously. Creating theCALL_MYPROC_N_TIMES
procedure isn't strictly necessary-- it just makes building the string to execute in the job easier.An alternative would be to submit 1000 jobs each of which just called
MYPROC
once and relying on theJOB_QUEUE_PROCESSES
parameter to limit the number of jobs that would be run simultaneously. That would work, it's just more difficult to change database parameters if you want to run more of fewer simultaneous sessions-- it's easy to adjustL_NUM_SESSIONS
in the code I posted.