Thanks for the test case. But please include the table DDL too!
Anyway onto your question...
The array in your package lasts for the duration of your session. So for each update to true rows you another element to the array. Then insert all of these back into the table, including those from the previous update.
To resolve this, delete the array in the after update trigger:
SQL> create table audit_tab (
2 action varchar2(10),
3 who varchar2(10),
4 dte date,
5 x int,
6 y int
7 );
Table created.
SQL> create table t1 (
2 x number,
3 y number,
4 created date,
5 created_by varchar2(10),
6 status varchar2(10)
7 );
Table created.
SQL> CREATE OR REPLACE package TRI_pkg is
2 type t_dblogin is table of t1%rowtype index by pls_integer;
3 type t_audit is table of audit_tab%rowtype index by pls_integer;
4
5 v_dblogon tri_pkg.T_DBLOGIN;
6 v_audit tri_pkg.t_audit;
7 fire_on_insert boolean := true;
8
9 procedure delete_transaction(p_audit t_audit);
10 end;
11 /
Package created.
SQL> show errors
No errors.
SQL>
SQL> CREATE OR REPLACE package body TRI_pkg is
2 procedure delete_transaction(p_audit t_audit) is
3 pragma autonomous_transaction;
4 begin
5
6 INSERT INTO AUDIT_TAB(ACTION,WHO,DTE) VALUES('DELETE','SCOTT',SYSDATE);
7 COMMIT;
8
9 end;
10 end;
11 /
Package body created.
SQL> show errors
No errors.
SQL>
SQL> create or replace trigger before_dml_t1 before
2 delete or
3 insert or
4 update on t1 for each row declare v_login_user number;
5 begin
6 if deleting then
7 tri_pkg.delete_transaction ( tri_pkg.v_audit ) ;
8 raise_application_error ( -20002, 'data can not be deleted', true ) ;
9 end if; --CLOSE IF FOR DELETING
10 if inserting then
11 if tri_pkg.fire_on_insert then
12 :new.created := sysdate;
13 :new.created_by := user ;
14 end if;
15 end if; -- CLOSE IF FOR INSERTING
16 if updating then
17 if upper ( :old.status ) = 'FALSE' then
18 raise_application_error ( -20002, 'FALSE RECORDS CAN NOT BE UPDATED' ) ;
19 end if;
20 if upper ( :old.status ) = 'TRUE' then
21 tri_pkg.v_dblogon ( tri_pkg.v_dblogon.count+1 ) .x := :old.x;
22 tri_pkg.v_dblogon ( tri_pkg.v_dblogon.count ) .y := :old.y;
23 tri_pkg.v_dblogon ( tri_pkg.v_dblogon.count ) .created := :old.created;
24 tri_pkg.v_dblogon ( tri_pkg.v_dblogon.count ) .status := 'FALSE';
25 end if;
26 end if; --CLOSE IF FOR UPDATING
27 end before_dml_t1;
28 /
Trigger created.
SQL> show errors
No errors.
SQL>
SQL> CREATE OR REPLACE TRIGGER AFTER_DML_T1
2 AFTER UPDATE ON T1
3 BEGIN
4 IF UPDATING THEN
5 TRI_PKG.fire_on_insert := FALSE;
6 forall i in 1..TRI_PKG.v_dblogon.count()
7 INSERT INTO T1 values TRI_PKG.v_dblogon(i);
8 TRI_PKG.fire_on_insert := TRUE;
9 END IF;
10 tri_pkg.v_dblogon.delete;
11
12 END AFTER_DML_T1;
13 /
Trigger created.
SQL> show errors
No errors.
SQL>
SQL> INSERT INTO T1 VALUES(1,99,SYSDATE,'SCOTT','TRUE');
1 row created.
SQL> /
1 row created.
SQL> SELECT * FROM T1;
X Y CREATED CREATED_BY STATUS
---------- ---------- --------- ---------- ----------
1 99 07-DEC-16 CHRIS TRUE
1 99 07-DEC-16 CHRIS TRUE
SQL>
SQL> UPDATE T1 SET X=2;
2 rows updated.
SQL> SELECT * FROM T1;
X Y CREATED CREATED_BY STATUS
---------- ---------- --------- ---------- ----------
2 99 07-DEC-16 CHRIS TRUE
2 99 07-DEC-16 CHRIS TRUE
1 99 07-DEC-16 FALSE
1 99 07-DEC-16 FALSE
SQL> UPDATE T1 SET X=3;
UPDATE T1 SET X=3
*
ERROR at line 1:
ORA-20002: FALSE RECORDS CAN NOT BE UPDATED
ORA-06512: at "CHRIS.BEFORE_DML_T1", line 15
ORA-04088: error during execution of trigger 'CHRIS.BEFORE_DML_T1'
SQL> select * from t1;
X Y CREATED CREATED_BY STATUS
---------- ---------- --------- ---------- ----------
2 99 07-DEC-16 CHRIS TRUE
2 99 07-DEC-16 CHRIS TRUE
1 99 07-DEC-16 FALSE
1 99 07-DEC-16 FALSE
SQL> UPDATE T1 SET X=4 WHERE X=2;
2 rows updated.
SQL> SELECT * FROM T1;
X Y CREATED CREATED_BY STATUS
---------- ---------- --------- ---------- ----------
4 99 07-DEC-16 CHRIS TRUE
4 99 07-DEC-16 CHRIS TRUE
1 99 07-DEC-16 FALSE
1 99 07-DEC-16 FALSE
2 99 07-DEC-16 FALSE
2 99 07-DEC-16 FALSE
2 99 07-DEC-16 FALSE
2 99 07-DEC-16 FALSE
8 rows selected.
But I'm not really sure what you're trying to do here. What's the business problem you're trying to solve by doing this?