Oracle® Database Administrator's Guide 11g Release 1 (11.1) Part Number B28310-01 |
|
|
View PDF |
An example of creating a job using DBMS_JOB
is the following:
VARIABLE jobno NUMBER; BEGIN DBMS_JOB.SUBMIT(:jobno, 'INSERT INTO employees VALUES (7935, ''SALLY'', ''DOGAN'', ''sally.dogan@xyzcorp.com'', NULL, SYSDATE, ''AD_PRES'', NULL, NULL, NULL, NULL);', SYSDATE, 'SYSDATE+1'); COMMIT; END; /
An equivalent statement using DBMS_SCHEDULER
is the following:
BEGIN DBMS_SCHEDULER.CREATE_JOB( job_name => 'job1', job_type => 'PLSQL_BLOCK', job_action => 'INSERT INTO employees VALUES (7935, ''SALLY'', ''DOGAN'', ''sally.dogan@xyzcorp.com'', NULL, SYSDATE,''AD_PRES'', NULL, NULL, NULL, NULL);'); start_date => SYSDATE, repeat_interval => 'FREQ = DAILY; INTERVAL = 1'); END; /