1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| CREATE OR REPLACE PACKAGE dbms_job IS
-- for backward compatibility. Not used anymore.
any_instance CONSTANT BINARY_INTEGER := 0;
-- Parameters are:
--
-- JOB is the number of the job being executed.
-- WHAT is the PL/SQL procedure to execute.
-- The job must always be a single call to a procedure. The
-- routine may take any number of hardcoded parameters.
-- Special parameter values recognized are:
-- job: an in parameter, the number of the current job
-- next_date: in/out, the date of the next refresh
-- broken: in/out, is the job broken. The IN values is FALSE.
-- Always remember the trailing semicolon.
-- Some legal values of WHAT (assuming the routines exist) are
-- 'myproc( ''10-JAN-82'', next_date, broken);'
-- 'scott.emppackage.give_raise( ''JENKINS'', 30000.00);'
-- 'dbms_job.remove( job);'
-- NEXT_DATE is the date at which the job will next be automatically run,
-- assuming there are background processes attempting to run it.
-- INTERVAL is a date function, evaluated immediately before the job starts
-- executing. If the job completes successfully, this new date is placed
-- in NEXT_DATE. INTERVAL is evaluated by plugging it into the statement
-- select INTERVAL into next_date from dual;
-- INTERVAL must evaluate to a time in the future. Legal intervals include
-- 'sysdate + 7' -- execute once a week
-- 'NEXT_DAY(sysdate,''TUESDAY'')' -- execute once every tuesday
-- 'null' -- only execute once
-- If INTERVAL evaluates to null and a job completes successfully, then
-- the job is automatically deleted from the queue.
PROCEDURE isubmit ( job IN BINARY_INTEGER,
what IN VARCHAR2,
next_date IN DATE,
interval IN VARCHAR2 DEFAULT 'null',
no_parse IN BOOLEAN DEFAULT FALSE);
-- Submit a new job with a given job number.
PROCEDURE submit ( job OUT BINARY_INTEGER,
what IN VARCHAR2,
next_date IN DATE DEFAULT sysdate,
interval IN VARCHAR2 DEFAULT 'null',
no_parse IN BOOLEAN DEFAULT FALSE,
-- Bug 1346620: replace pkg vars with constants.
-- Default for instance = dbms_job.any_instance.
instance IN BINARY_INTEGER DEFAULT 0,
force IN BOOLEAN DEFAULT FALSE );
-- Submit a new job. Chooses JOB from the sequence sys.jobseq.
-- instance and force are added for jobq queue affinity
-- If FORCE is TRUE, then any positive integer is acceptable as the job
-- instance. If FORCE is FALSE, then the specified instance must be running;
-- otherwise the routine raises an exception.
-- For example,
-- variable x number;
-- execute dbms_job.submit(:x,'pack.proc(''arg1'');',sysdate,'sysdate+1');
PROCEDURE remove ( job IN BINARY_INTEGER );
-- Remove an existing job from the job queue.
-- This currently does not stop a running job.
-- execute dbms_job.remove(14144);
PROCEDURE change ( job IN BINARY_INTEGER,
what IN VARCHAR2,
next_date IN DATE,
interval IN VARCHAR2,
instance IN BINARY_INTEGER DEFAULT NULL,
force IN BOOLEAN DEFAULT FALSE);
-- Change any of the the user-settable fields in a job
-- Parameter instance and force are added for job queue affinity
-- If what, next_date,or interval is null, leave that value as-is.
-- instance defaults to NULL indicates instance affinity is not changed.
-- If FORCE is FALSE, the specified instance (to which the instance number
-- change) must be running. Otherwise the routine raises an exception.
-- If FORCE is TRUE, any positive integer is acceptable as the job instance.
-- execute dbms_job.change( 14144, null, null, 'sysdate+3');
PROCEDURE what ( job IN BINARY_INTEGER,
what IN VARCHAR2 );
-- Change what an existing job does, and replace its environment
PROCEDURE next_date ( job IN BINARY_INTEGER,
next_date IN DATE );
-- Change when an existing job will next execute
PROCEDURE instance ( job IN BINARY_INTEGER,
instance IN BINARY_INTEGER,
force IN BOOLEAN DEFAULT FALSE);
-- Change job instance affinity. FORCE parameter works same as in SUBMIT
PROCEDURE interval ( job IN BINARY_INTEGER,
interval IN VARCHAR2 );
-- Change how often a job executes
PROCEDURE broken ( job IN BINARY_INTEGER,
broken IN BOOLEAN,
next_date IN DATE DEFAULT SYSDATE );
-- Set the broken flag. Broken jobs are never run.
PROCEDURE run ( job IN BINARY_INTEGER,
force IN BOOLEAN DEFAULT FALSE);
-- Run job JOB now. Run it even if it is broken.
-- Running the job will recompute next_date, see view user_jobs.
-- execute dbms_job.run(14144);
-- Warning: this will reinitialize the current session's packages
-- FORCE is added for job queue affinity
-- If FORCE is TRUE, instance affinity is irrelevant for running jobs in
-- the foreground process. If FORCE is FALSE, the job can be run in the
-- foreground only in the specified instance. dbms_job.run will raise an
-- exception if FORCE is FALSE and the connected instance is the wrong one.
PROCEDURE user_export ( job IN BINARY_INTEGER,
mycall IN OUT VARCHAR2);
-- Produce the text of a call to recreate the given job
PROCEDURE user_export ( job IN BINARY_INTEGER,
mycall IN OUT VARCHAR2,
myinst IN OUT VARCHAR2);
-- Procedure is added for altering instance affinity (8.1+) and perserve the
-- compatibility
--------------------------------------------------------------
-- Return boolean value indicating whether execution is in background
-- process or foreground process
-- jobq processes are no longer background processes, background_processes
-- will be removed in 8.3 or later
-------------------------------------------------------------
FUNCTION background_process RETURN BOOLEAN;
FUNCTION is_jobq RETURN BOOLEAN;
END;
/ |
Partager