1 CREATE OR REPLACE PACKAGE BODY purge_methods IS
4 (date_in in objects.deleted_date%type)
8 --open the cursor for the object ids we want to purge.
9 --we will use these ids to delete child records from other tables
10 FOR x IN (SELECT /*+ INDEX (OBJECTS DELETED_OBJECT_IDX) */ object_id
12 WHERE deleted_date < date_in) LOOP
15 dbms_output.put_line ('Starting to delete....');
19 DELETE FROM armor nologging WHERE object_id = x.object_id;
21 DELETE FROM battlefield_marker_objects nologging WHERE object_id = x.object_id;
22 DELETE FROM battlefield_participants nologging WHERE region_object_id = x.object_id;
23 DELETE FROM battlefield_participants nologging WHERE character_object_id = x.object_id ;
24 DELETE FROM biographies nologging WHERE object_id = x.object_id ;
25 DELETE FROM building_objects nologging WHERE object_id = x.object_id ;
26 DELETE FROM cell_objects nologging WHERE object_id = x.object_id ;
27 DELETE FROM creature_objects nologging WHERE object_id = x.object_id ;
28 DELETE FROM experience_points nologging WHERE object_id = x.object_id ;
29 DELETE FROM factory_objects nologging WHERE object_id = x.object_id ;
30 DELETE FROM guild_objects nologging WHERE object_id = x.object_id ;
31 DELETE FROM harvester_installation_objects nologging WHERE object_id = x.object_id ;
32 DELETE FROM installation_objects nologging WHERE object_id = x.object_id ;
33 DELETE FROM intangible_objects nologging WHERE object_id = x.object_id ;
34 DELETE FROM location_lists nologging WHERE object_id = x.object_id ;
35 DELETE FROM manf_schematic_attributes nologging WHERE object_id = x.object_id ;
36 DELETE FROM manf_schematic_objects nologging WHERE object_id = x.object_id ;
37 DELETE FROM manufacture_inst_objects nologging WHERE object_id = x.object_id ;
38 DELETE FROM mission_objects nologging WHERE object_id = x.object_id ;
40 DELETE FROM object_variables nologging WHERE object_id = x.object_id ;
41 DELETE FROM planet_objects nologging WHERE object_id = x.object_id ;
42 DELETE FROM player_objects nologging WHERE object_id = x.object_id ;
43 DELETE FROM property_lists nologging WHERE object_id = x.object_id ;
44 DELETE FROM resource_container_objects nologging WHERE object_id = x.object_id ;
45 DELETE FROM scripts nologging WHERE object_id = x.object_id ;
46 DELETE FROM static_objects nologging WHERE object_id = x.object_id ;
47 DELETE FROM tangible_objects nologging WHERE object_id = x.object_id ;
48 DELETE FROM token_objects nologging WHERE object_id = x.object_id ;
49 DELETE FROM universe_objects nologging WHERE object_id = x.object_id ;
50 DELETE FROM vehicle_objects nologging WHERE object_id = x.object_id ;
51 DELETE FROM waypoints nologging WHERE object_id = x.object_id ;
52 DELETE FROM weapon_objects nologging WHERE object_id = x.object_id ;
53 --delete messages target(object_id)
54 DELETE FROM messages nologging WHERE target = x.object_id ;
56 v_count := v_count + 1;
63 DELETE /*+ INDEX (OBJECTS DELETED_OBJECT_IDX) */ FROM objects
64 nologging WHERE deleted_date < date_in;
66 dbms_output.put_line (v_count||': iterations');
75 dbms_output.put_line ('never deleted');
77 dbms_output.put_line (v_count||': iterations');
87 v_date VARCHAR2(20) := date_in;
92 dbms_output.put_line(to_char(to_date(v_date, 'dd-mon-yy hh24:mi:ss') + v_time/24, 'DD-MON-YY hh24:mi:ss'));
93 v_retval := purge_objects(to_date(v_date, 'dd-mon-yy hh24:mi:ss') + v_time/24);
94 EXIT WHEN v_retval <> 0;
97 v_time := v_time + (59/60);
108 dbms_output.put_line('Purge return values: '||v_retval);
109 dbms_output.put_line('Time it failed at: '||v_time);