Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Copying tree-like data
Hi!
What is the best way of copying tree-like data?
I have a table looking like:
CREATE TABLE t1 (
ID_ INTEGER, Data ...,
where parent_id_ identifies other rows in t1.
I also have the sequence seq_IDs to generate unique IDs.
I'm trying to create a PL/SQL procedure 'Copy' which will start at a specified ID and make a copy of the tree from the specified row and down, using fresh IDs from the sequence and connecting them in the proper way.
The obvious solution (to me, anyway) is to use a recursive procedure, but I have a feeling that there should be a more efficient way, maybe using Oracle's START WITH/CONNECT BY queries.
Any suggestions?
/stefan Received on Mon Nov 27 2000 - 11:22:58 CST