O'Reilly logo

Beginning Oracle® Application Express by Paul Turley, Chris Leiter, Dan Wood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.1. Validation

At this point (and hopefully before), you should understand that the goal of your application is to collect, store, and report on data. If data is not correct — if the data lacks logical integrity — the condition will undermine the value of your entire application.

You have protected the integrity of your data in a couple of ways so far, by using data types for different columns, which limit, for instance, the data in some columns to numeric or date values. Your application contains some user interface objects that help guide your users to proper data values, including a date picker to select valid dates, radio button groups, and picklists.

Sometimes you cannot use these simple methods to ensure that the data entered is valid, often because the business rules that must be enforced are a bit more complex. For situations like this, APEX gives you the ability to specify validation rules that are applied to data before the data can be saved. If the data values do not pass the validation test, the data is not saved, protecting your all important data integrity, and an error message is displayed to let the user know why the data was rejected.

Try It Out: Validation Rules

The business rule you wish to enforce applies to the date of an order. Although you have already provided a default of the current date for this field, you want to check to make sure that the user has not entered a date in the future.

The basis for this rule is to prevent users from forward-dating ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required