Sample PL/SQL script for cleaning a detail table referring a master table

Have you ever had a need to write a PL/SQL snippet to clean a table. If you are in need, here is one below – Here is a sample PL/SQL code to delete old data from a detail table which is older than 120 days.

fi index_items.file_r%type;
cursor get_file_r is
select file_r from master_items where source=’WINWIN’ and date_r begin
for get_file_r_Rec in get_file_r
fi := get_file_r_Rec.file_r;
delete from index_items where file_r=fi;
end loop;

Add a Comment

Your email address will not be published. Required fields are marked *