0

Is there a method to import data from a single file into multiple Oracle tables while maintaining the referential integrity?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user602599
  • 661
  • 11
  • 22

2 Answers2

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
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