Oralce:
[Function description]: the current system time is automatically inserted into the getSysDate table every minute.
[1. Create a test table]
Create table getSysDate (test date );
[2. Create a stored procedure for scheduled execution]
Create or replace procedure insertSysDate
Begin
Insert into getSysDate values (sysdate );
End;
3. Create a JOB, that is, the process of creating the scheduled task to be executed]
Variable job1 number;
Begin
Dbms_job.submit (: job1, 'insertsysdate; ', sysdate, 'sysdate + 100 ');
End;
4. Start a JOB, that is, the process of starting and running a scheduled task]
Begin
Dbms_job.run (: job1 );
End;
[5. View running results]
Select to_char (test, 'yyyy/mm/dd hh24: mi: ss') from getSysDate;
The result is as follows:
10:53:11
11:05:51
[Some important parameters are supplemented]:
DBMS_JOB.SUBMIT (: jobno, // job no.
'Your _ procedure; ', // process to be executed
Trunc (sysdate) + 1/24, // next execution time
'Trunc (sysdate) + 1/24 + 1' // Interval
);
Delete job: dbms_job.remove (jobno );
Modify the operation to be executed: job: dbms_job.what (jobno, what );
Modify the next execution time: dbms_job.next_date (job, next_date );
Interval of modification: dbms_job.interval (job, interval );
Stop job: dbms. broken (job, broken, nextdate );
Start job: dbms_job.run (jobno );
Modify the value of job_queue_processes: (Ensure that the value is not 0; otherwise, the JOB will not run automatically)
You can view the value of select * from v $ parameter;
You can also directly use show parameter job_queue_processes; to view the following information:
NAME TYPE VALUE
-----------------------------------------------------------------------------
Job_queue_processes integer 10
Method 1, startup pfile = 'C: \ Oracle \ ora90 \ database \ initorcl. ora ';
// This method modifies the job_queue_processes parameter of the initorcl. ora file, and then restarts the database.
Method 2: alter system set job_queue_processes = 10
// This method does not take effect after the database is restarted. The system automatically modifies the init. ora file.
Will take effect later