Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Can a constraint use a sql statement?
I want to add a constraint a to a table checking that its foriegn key refrences a record that has specific data in its record.
A
==
Id (Foriegn Key to B.Id)
B
==
Id (Primary Key)
Type (Foriegn Key to C.Id)
C
==
Id (Primary Key)
Name
The contraint would be on A.Id that B.Type = C.Id where C.Name = 'Data';
CHECK (
A.Id IN (SELECT Id FROM B WHERE Type IN (SELECT Id FROM C WHERE Name = 'Data')) ) )
Does that make any sense? Is it possible to add?
Brian Received on Thu Oct 12 2000 - 14:17:21 CDT