Create trigger that updates table

Create trigger that updates table

 

  

I created 2 tables T1 & T2 with the same columns (col1 number(2), col2
number(2)).

What I would like to do is create an after insert trigger some how using
distinct keyword on col1.
Is there a way of doing this?

So say I insert the following into T1:

Insert into T1 (col1, col2) values (1, 1);
Insert into T1 (col1, col2) values (1, 2);
Insert into T1 (col1, col2) values (1, 3);
Insert into T1 (col1, col2) values (2, 2);
Insert into T1 (col1, col2) values (3, 1);

What I would like added to T2 col1 is:

1
2
3

I created a simple trigger but can't figure out how to add distinct to
it:

CREATE OR REPLACE TRIGGER INSERT_T2
AFTER INSERT
ON T1
FOR EACH ROW
BEGIN
INSERT INTO T2(COL1) VALUES(:NEW.COL1);
END;





Please consider the environment before printing this email *

Confidentiality Notice: This email transmission may contain confidential or legally privileged information that is intended only for the individual or entity named in the e-mail address. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or reliance upon the contents of this e-mail is strictly prohibited. If you have received this e-mail transmission in error, please reply to the sender, so that arrangements can be made for proper delivery, and then please delete the message from your in-box.



Oracle LazyDBA home page