jknj72
asked on
How to run a package in SQL Developer
I actually have 3 packages and I want them run in a certain sequence. Ive never done this before so Im looking for a little guidance. Lets say I have pkg1, pkg2 and pkg3. I have 2 procedures in pkg1 that I need run in a specific order(proc1 and then proc2) and when that package is complete I want to run the next 2 packages that only have 1 procedure each. This is all being done in SQL Developer..Any help would be appreciated...
Thanks
JK
Thanks
JK
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
something like this?
change the variable name and type to whatever you need and of course change the test conditions to whatever is appropriate
put it in the sql window and press F5
DECLARE
v_result NUMBER;
BEGIN
pkg1.proc1(v_result);
IF v_result > 0
THEN
pkg1.proc2(v_result);
IF v_result = 234423
THEN
pkg1.proc3(v_result);
IF v_result < 10
THEN
pkg2.proc1(v_result);
IF v_result = 0
THEN
pkg3.proc1(v_result);
END IF;
END IF;
END IF;
END IF;
END;
/
change the variable name and type to whatever you need and of course change the test conditions to whatever is appropriate
put it in the sql window and press F5
DECLARE
v_result NUMBER;
BEGIN
pkg1.proc1(v_result);
IF v_result > 0
THEN
pkg1.proc2(v_result);
IF v_result = 234423
THEN
pkg1.proc3(v_result);
IF v_result < 10
THEN
pkg2.proc1(v_result);
IF v_result = 0
THEN
pkg3.proc1(v_result);
END IF;
END IF;
END IF;
END IF;
END;
/
ASKER
Ok that makes sense but would this have to be manually run everyday or could I take this code and place it in a job or something that can be scheduled to run everyday?
You can schedule it to run with DBMS_SCHEDULER. Doc is here -> http://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse.htm#ADMIN034
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both...
ASKER