I was working on admin module of my project and had to insert values into 2 or more tables simultaneously as they are dependent on each other and are connected via primary key. So for example table1 is building which is connected to table2 (roofings) and table3 (exteriors) via building_number and a new building has to be added then I need to update roofings and exteriors accordingly.
Is there anyway in Oracle 10g to insert values into 2 or more tables using single sql statement? I tried using inner join but that doesn’t work. What can be best solution in such situation.
Thanks
As far as I know, there is no way you can pass 2 table references to
INSERT. But you can define your FK constraints asDEFERRABLE, so they will be checked when you commit transaction, not when you insert data into the tables. Take a look on this example