Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to insert values?
"Me" <me_at_privacy.net> schrieb im Newsbeitrag
news:sgfhcvku10nmo9c1e5u89mic8jgr990rt7_at_4ax.com...
> On Sun, 18 May 2003 21:44:22 GMT, Hans Forbrich wrote:
>
> :Me wrote:
> :
> :> On Sun, 18 May 2003 13:23:38 -0700, Ana C. Dent wrote:
> :> :The "obvious"(?) solution is to.....
> :> :
> :> :DISABLE the primary & foreign keys.
> :> :Load the data into the tables.
> :> :ENABLE the primary & foreign keys.
> :>
> :> Yes, that is an obvious solution. I infact used an 'obvious solution'
> :> even when I had problems creating the tables because each one had a
> :> foreign key!
> :>
> :> But is there a 'more correct' or 'elegant' solution to
> :>
> :> 1) Creating the tables
> :> 2) Inserting the values (with foreign and primary keys enabled)
> :>
> :
> :Your problem is that you have a closed, circular reference loop.
> :Eliminate one of the Foreign Key sets, think of that entry as the top of
> :the heap, and start inserting from there. If you draw a picture
> :describing your tables including the links between them, you should
> :quickly be able to decide which one(s) to eliminate (or defer or disable)
>
> I can do that for inserting the values once.
> But again if I enable the foreign keys then I will not be able to
> append further values in any table, right?
>
> So can I conclude that the basic design of the table is itself wrong?
>
> Thanks.
>
Well, maybe not completely "wrong", but hard to work with, if you have DML on it all the time, as you indicate.
Disabling the constraints is a work around for loading data _once a day_
maybe,
but if you have _constantly_ inserts, I would reconsider the data model
design.
But that depends on your problem ...
hth, Jan Received on Tue May 20 2003 - 03:08:54 CDT