J'ai une table qui stocke les arbres. Il y a un node_id et un parent_id.Quelle est la meilleure façon d'insérer un arbre d'une table à l'autre en utilisant Oracle
Quand je effectuez les opérations suivantes:
insert into table1 select * from table2 start with node_id = 1 connect by prior node_id = parent_id order by parent_id nulls first
Je reçois cette erreur:
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.
Je comprends pourquoi je reçois cette erreur. Je me demandais juste s'il y avait un moyen de le faire sans faire une procédure pl/sql récursive. Pensées? Si ce n'est pas possible, quelqu'un a-t-il une procédure comme celle-ci que je pourrais utiliser comme échantillon?
Je ne l'avais pas entendu parler de différé ... merci! C'est exactement ce dont j'ai besoin! – testing123