Skip to Main Content

Help with trigger that inserts into another table before the insert

819694Dec 6 2010 — edited Dec 6 2010
I have two tables:

TABLE A as follows:
x, y, z
1, 1, 1
1, 1, 2
1, 1, 3

TABLE B as follows
c, d, e, f
1, 1, 1, 8
1, 1, 1, 2
1, 1, 1, 6
1, 1, 2, 5
1, 1, 2, 10
1, 1, 2, 3
1, 1, 3, 12
1, 1, 3, 11
1, 1, 3, 15


I want a trigger that BEFORE the insert into TABLE B, I want to INSERT into TABLE A as follows:

c => x
d => y
e => z

ONLY IF a record of (x, y, z) doesnt already exist in TABLE A.

Ie. if record (1, 1, 3) already exists in TABLE A, we dont want to try to insert it again when inserting into TABLE B with values that contain (1, 1, 3).
This post has been answered by OracleUser on Dec 6 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Jan 3 2011
Added on Dec 6 2010
2 comments
79 views