Reputation: 1499
I have a form in my application which creates a record in a table called MISTAKES upon submission. either before this new record is created, or after (not sure which I want), I need to create a record in another table named FOLLOWUPS. The primary key for the record in FOLLOWUPS needs to then be added to the MISTAKES record, either though an update or just by populating a hidden page item before the MISTAKES record gets created through page submission.
I've been fiddling with triggers, DML, and PL/SQL processes trying to figure out the right way to do this. What is the accepted best practice to achieve what I'm going for here?
A bit of scenario clarification: we have auditors who look for errors made by our employees. When they find an error, they will submit a form creating a record in the MISTAKES table to document the error. At the same time I need to create a record in the FOLLOWUPS table to help track that our managers are following up on the errors, and what the resolution is (coaching, documentation, etc).
Any help would be appreciated.
Upvotes: 0
Views: 239
Reputation: 5035
One size doesn't fit all. Database triggers could help you because regardless of your UI, the secondary record would be created. Or you could create a second process in your APEX form submission.
Many advocate the use of PL/SQL "TAPIs" - APIs for each table which encapsulate any workings such as the one you describe.
Upvotes: 2