Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: The fable of DEMETRIUS, CONSTRAINTICUS, and AUTOMATICUS

Re: The fable of DEMETRIUS, CONSTRAINTICUS, and AUTOMATICUS

From: Tony Andrews <andrewst_at_onetel.com>
Date: 20 Oct 2004 12:59:48 -0700
Message-ID: <1098302387.996382.76820@z14g2000cwz.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US