oracle - tricky plsql procedure to delete data -
friends , pl/sql gurus...
i trying create procedure delete data audit table don't know start with..
it great if provide tips or pointer...
requirements:
procedure run on first saturday of month (not sure possible via pl/sql or have create separate job)
delete data older 2 months mon - sat , date shouldn't 1st of month. (i.e. leave sunday & 1st of month data older 2 months)
e.g.
*procedure delete_log begin delete audit_logs created >= trunc(sysdate - 60) , created < trunc(sysdate) , created != (sunday) , created != (first of month); commit; end delete_log;*
i don't have experience pl/sql tips appreciated..
thanks, mike
to schedule job can use cron job @ server level or oracle scheduler run tasks http://docs.oracle.com/cd/b28359_01/server.111/b28310/scheduse002.htm#i1006395
something work:
create or replace procedure delete_log begin delete audit_logs trunc (created) < add_months (trunc (sysdate), -2) , to_char (trunc (created), 'dy') != 'sun' , to_char (trunc (created), 'dd') != '01'; end; /
Comments
Post a Comment