create or replace procedure scott.test
as
begin
  delete from a where a.coltime+7<sysdate;
end

解决方案 »

  1.   

    用job;
    在sql*plus里面执行以下语句
    VARIABLE jobno number;
    begin
          DBMS_JOB.SUBMIT(:jobno, 
                  'delete from a where time<sysdate-7;', 
                   SYSDATE, 'sysdate+1');
             commit;
    end;
    /
    print jobno;
      

  2.   

    比如你建立的过程为scott.test
    VARIABLE jobno number;
    begin
          DBMS_JOB.SUBMIT(:jobno, 
                  scott.test;', 
                   SYSDATE, 'trunc(sysdate) + 1/24');
             commit;
    end;
    /
    每天1点执行。
    建议你看看job包的帮助
      

  3.   

    呵呵,错了应当是'trunc(sysdate) + 25/24'是每天1点执行。
    是'trunc(sysdate) + 27/24'是每天3点执行