1

Topic: The trigger on removal

Works the trigger on DML, and  changed  on the new created table.
It is necessary that in tables it was saved  no more count = 10000 for example if the amount was exceeded, works one more trigger and deletes
Here only how to delete last 5000 added ?

CREATE OR REPLACE TRIGGER AUDIT_TRIGGER_NAME BEFORE INSERT ON AUDIT_TABLE_LOGS
ENABLE
DECLARE
V_COUNT NUMBER;
BEGIN
SELECT COUNT (*) INTO V_COUNT FROM AUDIT_TABLE_LOGS;
IF V_COUNT> 10000 THEN
DELETE FROM AUDIT_TABLE_LOGS WHERE ROWID <= 5000;
END IF;
END;
/

In advance thanks!

2

Re: The trigger on removal

I apologize 1st were deleted 5000 added and remained last 5000

3

Re: The trigger on removal

Goofy122;
In the trigger difficult (it is necessary to pass almost in a single user mode)
Delete superfluous, , each hour
.....
stax

4

Re: The trigger on removal

Normally criterion is the period of storage, instead of a record count (or balance between an amount and period, but the period of storage all the same remains a lath).
Imho, but try to consider this variant as it is easy for implementing  in the trigger.
But if in any way, then variant Stax-a - interval  (count at each insertion in the trigger expensive enough pleasure, it is necessary as to delete, except a condition count, all the same with the registration insert_time)

5

Re: The trigger on removal

[quote =-2] Goofy122;
create sequence start with 1 maxvalue 5000 cycle;

However... It is pleasant to me. Very much. Cheap but good