Home » SQL & PL/SQL » SQL & PL/SQL » PL/SQL automatic procedure calls
PL/SQL automatic procedure calls [message #39995] Mon, 02 September 2002 22:39 Go to next message
Fabian
Messages: 19
Registered: October 2000
Junior Member
Hi Forum,

I have to write a very spezial tool for my Oracle9i database.

A PL/SQL funktion, which randomly chooses one of my five transaktion procedures(insert_in_A,insert_in_B,...), then randomly generate the value and execute the selected procedure.

Could anyone help me,

1st How to write a procedure which randomly chooses out of a range of specifed procedures?

2nd How I could determine the nessesary values of this randomly choosen procedure?

3rd How to execute?

THX

Fab
Re: PL/SQL automatic procedure calls [message #40010 is a reply to message #39995] Tue, 03 September 2002 09:14 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
There is a built-in random number generator (DBMS_RANDOM). The function could look something like:

v_random := trunc(dbms_random.value(1, 6));
 
if v_random = 1 then
  proc_1;
elsif v_random = 2 then
  proc_2;
...
end if;


You could also use DBMS_RANDOM to supply values for your transactions. See the docs for the various options available with this package.
Previous Topic: storage for number and character fields
Next Topic: update locking question
Goto Forum:
  


Current Time: Tue Apr 23 06:12:20 CDT 2024