Step 1:- Create a table
CREATE TABLE tblTest(
ID VARCHAR(50),
DATE_VALUE VARCHAR(50)
);
Step 2:- Create a store procedure
CREATE OR REPLACE PROCEDURE spTest AS
BEGIN
INSERT INTO tbltest ("ID", date_value) VALUES (SYS_GUID(), SYSDATE);
END;
Step 3:- Create a Job it will run the
"spTest" store procedure
begin
sys.dbms_scheduler.create_job(job_name => 'TESTJOB', --Job Name
job_type => 'STORED_PROCEDURE', --Job Type i.e. PL/SQL
Block,Store Procedure,Executable,Chain
job_action => 'spTest', --Procedure Name
start_date =>
to_date('28-06-2017
00:00:00',
'dd-mm-yyyy hh24:mi:ss'), -- Job Start Date
repeat_interval
=> 'Freq=Minutely;Interval=1', -- Job Frequency i.e.
--
yearly,Monthly,Weekly,Daily,Hourly
-- Minutely,Secondly and
Job Running Interval
end_date =>
to_date('29-06-2017
00:00:00',
'dd-mm-yyyy hh24:mi:ss'), -- Job End Date
job_class
=> 'DEFAULT_JOB_CLASS',
enabled => true,
auto_drop
=> false,
comments => '');
end;
Step 4:- Select a record
select * from tbltest;
Note:- Job will run each minute because we
have set the Job Frequency "Minutely" and Interval "1"
Step 5:- Drop the Job
BEGIN
dbms_scheduler.drop_job(job_name => 'TESTJOB');
END;
--Using UI Interface
Step 1:- Right on Job => New
Step 2:- DBMS Scheduler Screen
will display
Step 3:- Fill Necessary field of DBMS
Scheduler
Step 4:- Click on Apply Button to Create
the Job
Step 5:- Expand the Job Folder from left
pane where you can view your Job