Oracle Application Express Item
15 pts.
0
Q:
Oracle Application Express Item
I have two tables with parent-child relationship. Is there a way to automatically populate the foreign key field of the child table with the exact data from the primary key of the parent table?
ASKED: Apr 8 2008  1:04 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
495 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
This depends upon the primary key of the child table. If a record already exists in the child table with the given foreign key value and the parent record is updated, then a "post update trigger" on the parent table can be written to update the foreign key value of the child table. All key values of the child table must be available to ensure you update the correct row.

If a new record is inserted into the parent table with a new key value, then it would be necessary to have a "post insert trigger" on the parent table to create a new record in the child with the new value. But, this would not work properly unless all non-null and primary key column values were available to insert a new record into the child table.

So, the short answer to your question is "yes, if you have the right information available."
Last Answered: Apr 9 2008  7:22 PM GMT by Jcmdba   495 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0