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 -> inserting records from a table to another using %rowtype

inserting records from a table to another using %rowtype

From: swoop <carl.barrett_at_newcastle.gov.uk>
Date: 16 May 2005 08:02:59 -0700
Message-ID: <1116255779.442955.307070@o13g2000cwo.googlegroups.com>


Hi I would like to copy records from table a to table b using %rowtype.

Here is the code I have so far. The error I get is on line 15 (FOR rec1 in ab_cur)

            *
ERROR at line 15:

ORA-06550: line 15, column 13:
PLS-00103: Encountered the symbol "AB_CUR" when expecting one of the
following:

(

I hope someone can help.

Cheers.

DECLARE CURSOR ab_cur IS

SELECT	*
FROM	a
WHERE	This = 1
AND	That = 'Y';

b_rec b%rowtype;

BEGIN
OPEN ab_cur

FOR rec1 in ab_cur

LOOP

INSERT INTO b VALUES(rec1.????, rec1.????, rec1.????,
rec1.????, rec1.????, rec1.????, rec1.????, rec1.????,
rec1.????, rec1.????, rec1.????, rec1.????, rec1.????,
rec1.????, rec1.????, rec1.????, rec1.????, rec1.????,
rec1.????, rec1.????, rec1.????, rec1.????, rec1.????, );

EXIT WHEN ab_cur%NOTFOUND;

END LOOP;
CLOSE ab_cur
END; Received on Mon May 16 2005 - 10:02:59 CDT

Original text of this message

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