Subject Re: [ib-support] Self-referential constraints
Author Helen Borrie
At 01:11 PM 08-10-02 +0930, you wrote:
>How to set up a self-referential constraint for
>
> PersonTable(Child INTEGER NOT NULL, Parent INTEGER, Name VARCHAR(20)
> NOT NULL)
>
>that forces Parent to exist as a Child unless Parent is NULL?

If you want to have NULL representing the "root" of your self-referencing
structure, I don't know a way to use formal REFERENCES constraints to
enforce it. I almost always make 0 or -1 the root of such a structure
(enforced by triggers, not default values). When I have special need for a
NULL root, I don't use a formal FK but contrive it by hand with triggers.

Helen