Link to home
Start Free TrialLog in
Avatar of mousemat24
mousemat24

asked on

How to right a schuduled trigger that runs a stored procedure (in a package)

Hi

Wonder if you can help me?

Im new to oracle, so please bear with me. I need to create a trigger to run at 02:00am and it should run a stored procedure (which is located in a package)

Can someone please give me the code to do this?
Thanks
Mousemat24
Avatar of MikeOM_DBA
MikeOM_DBA
Flag of United States of America image


You cannot "run" a trigger, a trigger is a special procedure that executes each time the corresponding DML statement (INSERT/UPDATE/DELETE) is applied to the table. (Read about triggers in the manual).

You can write a procedure and schedule it to execute at any time using either the DBMS_JOBS package or the DBMS_SCHEDULER package.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Mike is correct, you need to use DBMS_JOB.  I'm not sure when the new DBMS_SCHEDULER appeared but I think it wasn't until 10g.

I suggest you take a look at the docs:
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_job.htm#999107
ASKER CERTIFIED SOLUTION
Avatar of Mark Geerlings
Mark Geerlings
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
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