-2

Is there any possibility to auto run procedure after a specific time/date? For example I want to auto run this stored procedure after 2 days:

CREATE OR REPLACE PROCEDURE deleteresetlinks
AS BEGIN  
  DELETE FROM passwordresetlink WHERE date_created <= TRUNC(SYSDATE) - 3;
END;
user230
  • 1
  • 2

1 Answers1

0

You can create a scheduler job along the lines of this:

begin
    dbms_scheduler.create_job
    ( job_name        => 'DELETE_RESET_LINKS'
    , job_type        => 'PLSQL_BLOCK'
    , job_action      => 'begin deleteresetlinks; end;'
    , start_date      => trunc(sysdate) +2
    , repeat_interval => 'freq=daily; interval=2;'
    , enabled         => true );
end;

Query USER_SCHEDULER_JOBS to check the details, and USER_SCHEDULER_JOB_LOG and USER_SCHEDULER_JOB_RUN_DETAILS for the run history.