Home » SQL & PL/SQL » SQL & PL/SQL » A timmed trigger
A timmed trigger [message #39806] Tue, 13 August 2002 05:34 Go to next message
Joan Miquel Padilla Salom
Messages: 2
Registered: August 2002
Junior Member
Hi,

I have a question, there's some way to launch a timmed trigger?

I need to erase every day a temporal table and i want to know how can i do.

Thanks :)
Re: A timmed trigger [message #39807 is a reply to message #39806] Tue, 13 August 2002 05:37 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
1. create a stored procedure to delete or truncate the records of the particular table.
2. Use dbms_job package to schedule  it. ie, shcedule the stored procedure to be execute in a timely fashion, like midnight everyday or something like that.

Re: A timmed trigger [message #39809 is a reply to message #39806] Tue, 13 August 2002 08:47 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
set serveroutput on
declare
   l_job number;
begin
    dbms_job.submit( job => l_job,
                     what => 'delete zzz where col1 < 100;',
                     next_date => sysdate, 
                     interval => 'trunc(sysdate + 1) + 10/24 /* 10am daily */' );
    commit;
    dbms_output.put_line( ' your job is # '|| l_job);
end;
/

For truncate:
what => 'begin execute immediate ''truncate table zzz''; end;'
Previous Topic: time taken in executing a query.
Next Topic: First Record From Table....
Goto Forum:
  


Current Time: Tue May 07 09:22:57 CDT 2024