Search This Blog

Friday, July 10, 2015

Oracle database Job Creation

Here is a simple job creating in Oracle database.

SQL> create table temp_data (id varchar2(10));

Table created.

SQL> create or replace procedure dpr_temp_data as
    begin
        insert into temp_data values ('Akter');
      commit;
  end;
 

Procedure created.

SQL>
So the first thing is to submit it with both the start time and interval correctly specified. If you cannot remember how many minutes there are in a day (1440) it is a good idea to use brackets. Let's compare submitting the job with your date specifications.

SQL> var job_no number
SQL> BEGIN
        DBMS_JOB.SUBMIT
         (
         job =>:job_no,
         WHAT=>'dpr_temp_data;',--Procedure
         next_date=>sysdate+1/24*60,
       interval=>'sysdate+1/24*60'
       );
       commit;
    END;
   

 PL/SQL procedure successfully completed.

 SQL> print job_no

     JOB_NO
 ----------
         71
Now, job will be executed every single minute

No comments:

Post a Comment