| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Conditional Relationships ?
>> I'm curious as to how one would go about setting up and enforcing a
Conditional Relationship. <<
Try a better example; a student is either a foreign students or a domestic student. Unlike your orders and order details example, the two cases are clearly not related to each other.
In Standard SQL-92, you would use a CREATE ASSERTION statement, which is like CHECK() constraint at the schema level. Here is one way
CREATE ASSERTION StudentClassification
CHECK (((SELECT student_nbr FROM DomesticStudents
UNION ALL
SELECT student_nbr FROM ForeignStudents)
EXCEPT
SELECT student_nbr FROM Students) IS NULL);
Received on Sat Dec 28 2002 - 23:11:44 CST
![]() |
![]() |