How can I perform a select in an check constraint?
Posted on 2004-03-24
I'd like to do the following:
ALTER TABLE local_sale_terms
ADD CONSTRAINT constr_check_cancelled
CHECK (NOT EXISTS (SELECT 1
GROUP BY parent_no,date_of_term,cancelled
But Oracle complains about a query in the constraint.
How can i enforce having only ONE Uncancelled row?
I can have many cancelled rows, but only one uncancelled row.
a unique index on (parent_no,date_of_term,cancelled) is therefore inappropriate.