6.6. A Table with Oracle Constraints and Business Rules
In this section a set of business rules is applied to INSERTS on the PROFESSORS table. We will initially enforce the rules with a BEFORE INSERT row trigger. This trigger will perform a variety of tasks. It will:
Override column values upon insert.
Enforce a strict business rule that may potentially result in the transaction being rejected through a call to RAISE_APPLICATION_ERROR.
Take an action. In this case print using DBMS_OUTPUT.
6.6.1. The Environment
The location of this logic is illustrated in Figure 6-2. The grayed area indicates where this trigger code fits into the overall INSERT statement process.
Figure 6-2. Location of Trigger Code.
The business rules in this example are being ...
Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.