20.1.5.1.1 Enforcing Rules with Read-Consistency

Use a page process after the data-saving processes to validate pending changes before APEX commits them.

When a user submits a page, page processes save any changes in the database. However, the APEX engine only commits the pending changes after all page submission processing succeeds. If any page process signals an error, this "vetoes" all pending changes so nothing is saved.

This gives you a powerful way to validate pending changes. Just add a page process after the ones that save user-submitted data changes. It can perform complex data validation using simple SQL statements. Oracle's read consistency model lets any queries it performs "see" the pending-but-not-yet-committed changes along with other unmodified data. Any aggregations like SUM or COUNT you perform always get an accurate answer. You can then reject the changes if an aggregate condition is invalid, just by signaling an error with an actionable message that helps the user fix the situation.