Variable Constraint Messages: Example 1

Previous Next

EXAMPLE 1:

In the Travel Agency, the business rule: "Guides must have a bank account" is implemented by a restrictive, single-record constraint:

SELECT    first_name, last_name

FROM    person

WHERE    guide = 'Y'

AND    bank_account IS NULL

Because the first_name and last_name columns are specified in the SELECT clause, you now can specify the message:

<person.first_name.value> <person.last_name.value> is a guide and must have a bank account.

The error message displayed will be:

"John Smith is a guide and must have a bank account".

You can also refer to alias names and labels.