 |
|
Oracle Tips by Burleson |
Chapter 4 -
Chaining Oracle Jobs Together
Conditional Job Runs using a Custom Table
Solution
-- Uncomment the following line to force a failure.
--RAISE_APPLICATION_ERROR(-20000,
-- 'This is a
fake error to prevent task_3 being executed');
-- The work has completed successfully so
unlock task_3
lock_task ('task_3', FALSE);
END IF;
EXCEPTION
WHEN OTHERS THEN
-- Don't unlock task_3.
NULL;
END task_2;
--
-----------------------------------------------------------------
--
-----------------------------------------------------------------
PROCEDURE task_3 AS
--
-----------------------------------------------------------------
BEGIN
IF unlocked('task_3') THEN
lock_task ('task_3');
INSERT INTO job_chain (created_timestamp,
task_name)
VALUES (systimestamp, 'TASK_3');
COMMIT;
END IF;
END task_3;
--
-----------------------------------------------------------------
--
-----------------------------------------------------------------
 |
For more details and scripts, see my new book "
Oracle
Tuning: The Definitive Reference", over 900 pages
of BC's favorite tuning tips & scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot. |
|