Link to home
Start Free TrialLog in
Avatar of jknj72
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
SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jknj72
jknj72

ASKER

ok makes sense but where would I be making these calls from. We have to put this on a schedule but that's not my concern yet. I just need to know where I would run the code you suggested? Also, I have an out parameter for each procedure. Would I be able to check each out parameter before running the next proc?
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;
/
Avatar of jknj72

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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jknj72

ASKER

Thank you both...