DBMS

xiaoxiao2021-03-06  66

Usage of DBMS_JOB package

Contains the following subsections:

Broken () process. Change () process. Interval () process. ISUBMIT () process. Next_date () process. Remove () process. Run () process. Submit () process. User_export () process. What () process.

1. The Broken () process updates a status of a submitted work, typically used to mark a broken job as unbeatable work. This process has three parameters: Job, Broken and Next_Date.

Procedure Broken (Job in Binary_INTEGER, BROKEN in Boolean, Next_date In Date: = SYSDATE)

The Job parameter is a work number, which is uniquely identified in the question. The Broken parameter indicates whether this work will be marked as broken - True Description This work will be tagged as broken, while Flase shows that this work will be marked as unbreak. When the next_date parameter indicates when this work will run again. This parameter default is the current date and time.

2, the change () process is used to change the settings of the specified work. This process has four parameters: Job, What, Next_Date and Interval.

Procedure change (Job in binary_integer, what in varcha2, next_date in date, interval in varchar2)

This job parameter is an integer value that uniquely identifies this job. What parameter is a PL / SQL code block that is running running. Next_date parameter indicates when this work will be executed. The interval parameter indicates a frequency of a working product.

3, the interval () process is used to explicitly set the number of time intervals between works. This process has two parameters: Job and Interval.

Procedure Interval (Job in Binary_INTEGER, Interval in varchar2)

The JOB parameter identifies a specific job. The interval parameter indicates a frequency of a working product.

4. The isubmit () process is used to submit a work with a specific work number. This process has five parameters: job, what, next_date, interval with no_parse.

Procedure isubmit (Job in binary_ineger, what in varcha2, next_date in date, interval in varchar2, no_parse in booEan: = false)

The only difference between this process and the submit () process is that this Job parameter is passed as the IN type parameter and includes a work number provided by the developer. If the task number provided has been used, an error will be generated.

5, the next_date () process is used to explicitly set an execution time of a job. This process receives two parameters: job and next_date.

Procedure next_date (job in binary_ineger, next_date in date)

Job identifies an existing job. The next_date parameter indicates the date and time of this work should be performed.

6, the transove () process to delete a work that is planned. This process receives a parameter:

Procedure Remove (Job in binary_ineger);

The JOB parameter uniquely identifies a job. The value of this parameter is the value of the JOB parameter returned by the Submit () process for this purpose. The work that has been run cannot be deleted by the calling process. 7. The run () process is used to execute a specified job immediately. This process only receives a parameter:

Procedure run (Job in binary_ineger)

The job of the JOB parameter identifier will be executed immediately.

8. Use the submit () process, work is planned normally. This process has five parameters: job, what, next_date, interval with no_parse.

Procedure Submit (Job out binary_ineger, what in varcha2, next_date in date, interval in varcha2, no_parse in booEan: = false)

The JOB parameter is binary_ineger returned by the submit () process. This value is used to uniquely identify one job. The WHAT is the PL / SQL code block that will be executed. When the next_date parameter is specifically running this work. When the interval parameter will be re-executed. The NO_PARSE parameter indicates whether this work should be syntax analysis when submitted or executed - True Indicates that this PL / SQL code should perform syntax analysis in its first execution, and false indicates that this PL / SQL code should be immediately performed. .

9, the user_export () process returns a command, this command is used to arrange an existing job so that this work can be re-submitted. This program has two parameters: Job and my_call.

Procedure user_export (job in binary_ineger, my_call in out varcha2)

The JOB parameter identifies a work arranged. My_call parameters are included in its current state to resubmit the text required for this job.

10, what () procedure promises to reset this running command when performing. This process receives two parameters: Job and what.

Procedure what (job in binary_ineger, what in out varchar2)

The JOB parameter identifies an existing job. What parameter indicates the new PL / SQL code that will be executed. A simple example:

Create Test Table SQL> Create Table A (A Date);

The table has been created.

Create a custom process SQL> Create or Replace Procedure Test AS 2 Begin 3 INSERT INTO A VALUES (SYSDATE); 4 End; 5 /

The process has been created.

Create Jobsql> Variable Job1 Number; SQL> SQL> Begin 2 dbms_Job.Submit (: Job1, 'Test;', sysdate, 'sysdate 1/1440'); - 1440 minutes a day, a minute Run TEST Procedure 3 End; 4 /

The PL / SQL process has been successfully completed.

Run Jobsql> Begin 2 dbms_Job.Run (: JOB1); 3 end; 4 /

The PL / SQL process has been successfully completed.

SQL> SELECT TO_CHAR (A, 'YYYY / MM / DD HH24: MI: SS') Time from A;

Time ------------------- 2001/01/07 23: 51: 212001/01/07 23: 52:222001/01/07 23:53:24

Delete Jobsql> Begin 2 dbms_job.remove (: JOB1); 3 End; 4 / PL / SQL process has been successfully completed.

! - Note NLS parameters NLS_LANGUAGE = 'AMERICAN' NLS_TERRITORY = 'AMERICA' NLS_CURRENCY = '$' NLS_ISO_CURRENCY = 'AMERICA' NLS_NUMERIC_CHARACTERS = '.,' NLS_DATE_FORMAT = 'DD-MON-RR' NLS_DATE_LANGUAGE = 'AMERICAN' NLS_SORT = 'BINARY '

转载请注明原文地址:https://www.9cbs.com/read-106463.html

New Post(0)