After each row trigger only fires on the 2nd of 2 eligible rows
Hi,
Oracle 12c database with 2 tables:
CUSTOMERS and REGISTRATIONS, both with the same columns:
CUSTOMER_ID NUMBER(20)
COMPANY_ID VARCHAR2(22)
BLOCKED VARCHAR2(1)
USERNAME VARCHAR2(255)
UPDATED_DTM TIMESTAMP(6)
I have a trigger defined as follows:
create or replace trigger REGISTRATION_A_I
for insert on REGISTRATIONS
compound trigger
cust_id number(20,0);
after each row is
begin
cust_id := :new.CUSTOMER_ID;
end after each row;
after statement is
begin
update REGISTRATIONS REG set (REG.COMPANY_ID, REG.BLOCKED, REG.USERNAME, REG.UPDATED_DTM) = (select CID.COMPANY_ID, CID.BLOCKED, CID.USERNAME, CID.UPDATED_DTM from CUSTOMERS CID where CID.CUSTOMER_ID=cust_id) where REG.CUSTOMER_ID=cust_id;