Subject Re: Creating Foreign keys
Author Alexander V.Nevsky
--- In ib-support@yahoogroups.com, "Riho-Rene Ellermaa"
<r.ellermaa@h...> wrote:
> I have table MASS_PERSONS which has foreign key to MASSGROUPS table.
> ALTER TABLE MASS_PERSONS_LV ADD CONSTRAINT FK_MASSPERS FOREIGN KEY
(GR_ID) REFERENCES MASSGROUPS(ID) ON UPDATE CASCADE ON DELETE
>
> Now I wanted to add another table (MASS_PERSONS_LV) and create
similar foreign key, but I get error "Object MASSGROUPS is in use".
> Is it not possible to have 2 tables, both having foreign key linked
to the same table?

No, there is not such a limitation, reason is simply we can't create
FK if server is'nt sure nobody work with "master" table at this
moment. If anybody (including your own connection) touched table
MASSGROUPS, it is in use. So, to create FK you should be a) sure you
alone is connected to database, including secondary connections from
your computer (from Delphi IDE etc) b) you did'nt touched master
table in statements within this connection. In practice when you
encounter this most simply way is to check condition a) and close your
connection, reconnect and repeat statement.

Best regards, Alexander.