SVRMGR> VARIABLE jobno number;
SVRMGR> begin
2> DBMS_JOB.SUBMIT(:jobno,
3> 'dbms_ddl.analyze_object(''TABLE'',
4> ''VALERIE'', ''ACCOUNTS'',
5> ''ESTIMATE'', NULL, 50);',
6> SYSDATE, 'SYSDATE + 1');
7> commit;
8> end;
9> /
Statement processed.
SVRMGR> print jobno
JOBNO
----------
14144
In a deferred transaction, note that, unless explicitly specified otherwise, the user who initiated a transaction will determine which database link is used. The owner can be specified for a deferred transaction by using the DEFER_SYS.EXECUTE parameter, execute_as_user. See
.
Once a job is assigned a job number, that number does not change. Even if the job is exported and imported, its job number remains the same.
Attention: In the job definition, use two single quotation marks around strings. Always include a semicolon at the end of the job definition.
Normally, the job definition is a single call to a procedure. The procedure call can have any number of parameters.
There are special parameter values that Oracle recognizes in a job definition. Table 10 - 3 lists these parameters.
| Parameter | Mode | Description |
| job | IN | The number of the current job. |
| next_date | IN/OUT | The date of the next execution of the job. |
| broken | IN/OUT | Status of job, broken or not broken. The IN value is FALSE. |
'myproc(''10-JAN-82'', next_date, broken);'
'scott.emppackage.give_raise(''KANE'', 3000.00);'
'dbms_job.remove(job);'
If a job should be executed periodically at a set interval, use a date expression similar to 'SYSDATE + 7' in the INTERVAL parameter. For example, if you set the execution interval to 'SYSDATE + 7' on Monday, but for some reason (such as a network failure) the job is not executed until Thursday, 'SYSDATE + 7' now evaluates to every Thursday, not Monday.
If you always want to automatically execute a job at a specific time, regardless of the last execution (for example, every Monday), the INTERVAL and NEXT_DATE parameters should specify a date expression similar to 'NEXT_DAY(TRUNC(SYSDATE), ''MONDAY'')'.
Table 10 - 4 lists sample date expressions used for job execution intervals.
Additional Information: The parameters for the DBMS_JOBS.SUBMIT procedure are described in Table 12 - 36.