自带的docSubmitting a Job to the Job Queue To submit a new job to the job queue, use the SUBMIT procedure in the DBMS_JOB package: DBMS_JOB.SUBMIT( job OUT BINARY_INTEGER, what IN ARCHAR2, next_date IN DATE DEFAULT SYSDATE, interval IN VARCHAR2 DEFAULT 'null', no_parse IN BOOLEAN DEFAULT FALSE) The SUBMIT procedure returns the number of the job you submitted. Table 7-3 describes the procedure's parameters. Table 7-3 Parameters for DBMS_JOB.SUBMIT Parameter Description job This is the identifier assigned to the job you created. You must use the job number whenever you want to alter or remove the job. For more information about job numbers, see "Job Numbers" . what This is the PL/SQL code you want to have executed. For more information about defining a job, see "Job Definitions" . next_date This is the next date when the job will be run. The default value is SYSDATE. interval This is the date function that calculates the next time to execute the job. The default value is NULL. INTERVAL must evaluate to a future point in time or NULL. For more information on how to specify an execution interval, see "Job Execution Interval" . no_parse This is a flag. The default value is FALSE. If NO_PARSE is set to FALSE (the default), Oracle parses the procedure associated with the job. If NO_PARSE is set to TRUE, Oracle parses the procedure associated with the job the first time that the job is executed. If, for example, you want to submit a job before you have created the tables associated with the job, set NO_PARSE to TRUE.
As an example, let's submit a new job to the job queue. The job calls the procedure DBMS_DDL.ANALYZE_OBJECT to generate optimizer statistics for the table DQUON.ACCOUNTS. The statistics are based on a sample of half the rows of the ACCOUNTS table. The job is run every 24 hours: SVRMGR> VARIABLE jobno number; SVRMGR> begin 2> DBMS_JOB.SUBMIT(:jobno, 3> 'dbms_ddl.analyze_object(''TABLE'', 4> ''DQUON'', ''ACCOUNTS'', 5> ''ESTIMATE'', NULL, 50);' 6> SYSDATE, 'SYSDATE + 1'); 7> commit; 8> end; 9> / Statement processed. SVRMGR> print jobno JOBNO ---------- 14144
To submit a new job to the job queue, use the SUBMIT procedure in the DBMS_JOB package: DBMS_JOB.SUBMIT( job OUT BINARY_INTEGER,
what IN ARCHAR2,
next_date IN DATE DEFAULT SYSDATE, interval IN VARCHAR2 DEFAULT 'null',
no_parse IN BOOLEAN DEFAULT FALSE)
The SUBMIT procedure returns the number of the job you submitted. Table 7-3 describes the procedure's parameters. Table 7-3 Parameters for DBMS_JOB.SUBMIT
Parameter Description
job This is the identifier assigned to the job you created. You must use the job number whenever you want to alter or remove the job.
For more information about job numbers, see "Job Numbers" .
what This is the PL/SQL code you want to have executed.
For more information about defining a job, see "Job Definitions" .
next_date This is the next date when the job will be run. The default value is SYSDATE.
interval This is the date function that calculates the next time to execute the job. The default value is NULL. INTERVAL must evaluate to a future point in time or NULL.
For more information on how to specify an execution interval, see "Job Execution Interval" .
no_parse This is a flag. The default value is FALSE.
If NO_PARSE is set to FALSE (the default), Oracle parses the procedure associated with the job. If NO_PARSE is set to TRUE, Oracle parses the procedure associated with the job the first time that the job is executed. If, for example, you want to submit a job before you have created the tables associated with the job, set NO_PARSE to TRUE.
As an example, let's submit a new job to the job queue. The job calls the procedure DBMS_DDL.ANALYZE_OBJECT to generate optimizer statistics for the table DQUON.ACCOUNTS. The statistics are based on a sample of half the rows of the ACCOUNTS table. The job is run every 24 hours: SVRMGR> VARIABLE jobno number;
SVRMGR> begin
2> DBMS_JOB.SUBMIT(:jobno,
3> 'dbms_ddl.analyze_object(''TABLE'',
4> ''DQUON'', ''ACCOUNTS'',
5> ''ESTIMATE'', NULL, 50);'
6> SYSDATE, 'SYSDATE + 1');
7> commit;
8> end;
9> /
Statement processed.
SVRMGR> print jobno
JOBNO
----------
14144
oracle帮助里的例子是带参数的,只是写成固定的了,不是变量,用变量真的不行?太局限了吧?大家帮帮忙啊!