Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Copy a record from 1-table to another

Copy a record from 1-table to another

From: JoeT <trubisz_at_yahoo.com>
Date: 14 Dec 2005 12:54:33 -0800
Message-ID: <1134593673.093461.231970@g44g2000cwa.googlegroups.com>


Greetings...

This is an extremely simplified version of the actual problem, just to make it easier.

I have 2-tables: R(a) and S(a,b)

I want to do the following (which doesn't work), and I don't know what I need to do to
make it work. This is on a Oracle 9i system.

cursor c1 is select * from r;
r_rec c1%ROWTYPE;

begin

    open c1;
    loop

      fetch c1 into r_rec;
      exit when c1%NOTFOUND;

-- The next statement does not work since #columns in r_rec doesn't
match S.
-- This is the problem...what do I do to make this work?
      insert into s values r_rec;
      end loop;

end;

I tried something like: insert into s values(r_rec,1) as well, but that is syntactically incorrect.

Anyone have any suggestions?

Thanks,
Joe Received on Wed Dec 14 2005 - 14:54:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US