Is there a method to import data from a single file into multiple Oracle tables while maintaining the referential integrity?
Asked
Active
Viewed 821 times
2 Answers
2
Yes.
Without a lot more detail, I'll just say that you should look to external table to get the data from the file into the database, then select from the external table and use the 'INSERT ALL' feature to insert into multiple tables, from the single input.
Hope that helps.

Mark J. Bobak
- 13,720
- 6
- 39
- 67
-
Hi Mark,Can you please explain the details? Can I do this with SQL Developer? – user602599 Nov 29 '11 at 19:32
1
There are couple alternatives (not an exhaustive list):
- Walk the dependency graph of FOREIGN KEYs and make sure you insert data to "parents" before inserting it to "children".
- Defer all the FOREIGN KEYs, so order of insertion does not matter. This is OK if you can perform the whole import in a single transaction.
- Temporarily disable FOREIGN KEY constraints, import the data in any order, then re-enable them.

Branko Dimitrijevic
- 50,809
- 10
- 93
- 167