Sunday, April 14, 2019
Example Script to Drop Database Jobs (DBMS_SCHEDULER.DROP_JOB)
In this post, we have a given
an example script to drop a database job which was already created using CREATE_JOB
Wrapper Procedure:
CREATE OR REPLACE PROCEDURE drop_job(pov_errbuf OUT VARCHAR2,pon_retcode OUT NUMBER,piv_drop_job_name IN VARCHAR2)ISle_end_of_program EXCEPTION;lv_dummy_char VARCHAR2(200);lrec_job all_scheduler_jobs%ROWTYPE;position_ NUMBER;BEGIN-- check is job already existsBEGINSELECT job_nameINTO lv_dummy_charFROM all_scheduler_jobsWHERE UPPER(job_name) = piv_drop_job_name;EXCEPTIONWHEN NO_DATA_FOUND THENpov_errbuf := 'Job Does not exists.Error:'||SQLERRM;RAISE le_end_of_program;WHEN OTHERS THENpov_errbuf := 'Error while validating Job.Error:'||SQLERRM;RAISE le_end_of_program;END;-- drop the jobsdbms_scheduler.drop_job(piv_drop_job_name, TRUE);EXCEPTIONWHEN le_end_of_program THENpon_retcode := 1;WHEN OTHERS THENpov_errbuf := 'Unhandled Error while dropping job.Error:'||SQLERRM;pon_retcode := 2;END drop_job;
Testing Script:
SET SERVEROUTPUT ON;DECLARElv_errbuf VARCHAR2(4000);ln_retcode NUMBER;BEGINdrop_job (pov_errbuf => lv_errbuf,pon_retcode => ln_retcode,piv_job_name => 'TEST_SHAREORACLEAPPS');END;
Testing:
Do you think this Article is useful?
Subscribe to:
Post Comments (Atom)
Disclaimer
The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.
0 Responses to “Example Script to Drop Database Jobs (DBMS_SCHEDULER.DROP_JOB)”
Post a Comment