I'm new here in dba.stackexchange.com, so if I were to make any mistake, my apologies in advance.
I kinda confused on how trigger work. So I have a trigger called updcredaccess
on table A
that updates table B
on after update event. Then I need the currently updated value on table A
for other table to inspect, so I used autonomous transaction trigger
. But then when I update, the value on table A
doesn't seems to be updated with the current value.
Here is my table
Table Aand here is my trigger Table A trigger
id varchar(10)
val varchar(10)Table B
id varchar(10)
val varchar(10)
create or replace trigger updA after update on A for each row declare pragma autonomous_transaction; cek varchar2(5); begin commit; select val into cek from A where id = :new.id; dbms_output.put_line('Cek cek: ' || cek); update B set val = :new.val where id = :new.id; commit; end; /
And for table B Table B trigger
create or replace trigger updB after update on B for each row declare v varchar2(5); begin select val into v from B where id = :new.id; -- Some other pl/sql code -- end; /
I then input 2 records like
insert all into A values ('a', 'false') into A values ('b', 'false') select * from dual;
Then i tried this code
update A set val = 'true'
The query works fine. But I was so confused because at the log console it says
Cek cek: false (The output log at trigger A)
The value still hasn't changed.
So, what I need is the current new val
value at the 2nd trigger, so It can be processed. Can anyone help?