| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Relation problem
wrote:
> On 26 Jan 2001 23:25:21 GMT, hidders_at_REMOVE.THIS.win.tue.nl (Jan
> Hidders) wrote:
>
> >By now I hope that you understand that I am missing the following
> >constraint in your SQL:
>
> There's a good reason it's not there.
>
> >ALTER TABLE Parties
> >ADD CONSTRAINT AbstractClass
> >CHECK (
> > EXISTS (
> > SELECT * FROM Persons WHERE Persons.PersonID = Parties.PartyID
> > )
> > OR
> > EXISTS (
> > SELECT * FROM Organizations WHERE Organizations.OrgID = Parties.PartyID
> > )
> >)
>
> Add that constraint, and you can't add rows to any of the tables.
You can if you have deferred constraint checking as defined in SQL'92 (and in Oracle 8, I believe).
> It's an interesting approach, but I don't think it will catch on in
> practice.
That is not what I wanted to suggest. All I wanted to say is that if you have something similar to an abstract class then this constraint should be considered. Usually it will be quite acceptable and perhaps even useful to ignore it and allow the class to be non-abstract, and in other cases you might ignore it because implementing it would lead to the update problems you suggested. But, as always, these design decisions should be taken deliberately and with care.
PS. Can I ask you to set you full name in your newsreader? I believe
you are using Forte Free Agent so that should be possible in 'Preferences' under the 'User' tab. Otherwise the attribution of what you wrote will sometimes look a bit awkward as is the case in this posting.
-- Jan HiddersReceived on Sat Jan 27 2001 - 15:33:27 CST
![]() |
![]() |