SQL Language (MOSC)

MOSC Banner

After each row trigger only fires on the 2nd of 2 eligible rows

edited Feb 27, 2019 4:02AM in SQL Language (MOSC) 5 commentsAnswered

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;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center