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

Home -> Community -> Usenet -> c.d.o.tools -> Re: newbie: copy records from one table to another

Re: newbie: copy records from one table to another

From: Reiner <slugu_at_yahoo.com>
Date: 30 Jul 2001 17:13:14 -0700
Message-ID: <922e593d.0107301613.4f2d1ba8@posting.google.com>

"Yaroslav Perventsev" <p_yaroslav_at_cnt.ru> wrote in message news:<9jomq1$4m5$1_at_news247.cnt.ru>...
> and all? more code..?

There was no more code - just more fields.

> AFAIK...It's mean - table TRANSACTION havn't field CLIENT_ID.

Yes, I had the fields from a different table. Below is the entire code which I save into an SQL file and then run using SQL*Plus using the @c:... syntax.

DECLARE
    CURSOR c1 IS
    select * from TRANSACTION where TRANSACTION_DATE<'01-feb-00 00:00' ORDER BY transaction_date;

BEGIN
        OPEN c1;

	FOR txn IN c1 LOOP
		insert into TRANSACTIONBACKUP values (
			txn.TRANSACTION_ID,
			txn.TRANSACTION_DATE,
			txn.ORDER_ID,
			txn.AMOUNT,
			txn.PAYER,
			txn.PAYEE,
			txn.PAYER_ACCT_BAL,
			txn.PAYEE_ACCT_BAL,
			txn.TRANS_CODE
			);
		delete from TRANSACTION where transaction_id = txn.transaction_id;
		commit;
	END LOOP;

	CLOSE c1;

END; I still get the following errors.

DECLARE
*
ERROR at line 1:

ORA-06511: PL/SQL: cursor already open
ORA-06512: at line 3
ORA-06512: at line 6


So it doesn't like the DECLARE statement. What should I do? Received on Mon Jul 30 2001 - 19:13:14 CDT

Original text of this message

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