| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: The fable of DEMETRIUS, CONSTRAINTICUS, and AUTOMATICUS
Laconic2 wrote:
> I hate to keep beating the same dead horse, but won't CREATE DOMAIN
do
> exactly this?
>
> CREATE DOMAIN valid_salary CONSTRAINT valid_salary BETWEEN 0 AND
100000;
>
>
> CREATE TABLE EMPLOYEES
> (...
> SALARY VALID_SALARY,
> ...);
Yes. But I think it is important to distinguish between 2 different
kinds of "rule":
1) "Salary IS a numeric value between 0 and 999999"
2) "Salaries are restricted (by current company policy) to a maximum of
100000"
The first is what a DOMAIN does: it is meant to be a permanent restriction (like a data type definition). The second is a rule that is very likely to change over time - perhaps annually say. I'm not sure a DOMAIN change is appropriate for that. That's why I actually agree with Kenneth that the user should be able to change it without performing DDL. The way I would choose to do it would be to store the maximum in a table, and then have a constraint to check the salary value against the maximum value. Received on Wed Oct 20 2004 - 14:59:48 CDT
![]() |
![]() |