我有一個存儲樹的表。有一個node_id和parent_id。什麼是使用Oracle從一個表插入到另一個表的最佳方式
當我嘗試以下方法:
insert into table1 select * from table2 start with node_id = 1 connect by prior node_id = parent_id order by parent_id nulls first
我得到這個錯誤:
Error starting at line 6 in command:
insert into table1 select * from table2 start with node_id = 1 connect by prior node_id = parent_id order by parent_id nulls first
Error report:
SQL Error: ORA-02291: integrity constraint (XVTEST.REGIONAL_DEFAULT_DELETE) violated - parent key not found
02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found"
*Cause: A foreign key value has no matching primary key value.
*Action: Delete the foreign key or add a matching primary key.
我明白爲什麼我收到此錯誤。我只是想知道是否有辦法做出這種做出一個遞歸的PL/SQL程序。思考?如果不可能有人有這樣的程序,我可以用作樣本?
我甚至沒有聽說過延期......謝謝!這正是我需要的! – testing123 2011-05-24 23:38:09