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 -> Looking for a faster way to Update/Insert

Looking for a faster way to Update/Insert

From: Ken Sproule <kenmn_at_tds.net>
Date: Mon, 27 Mar 2000 14:02:09 GMT
Message-ID: <45qudskinuiarov77g99l6j6fehn38k32l@4ax.com>


Thanks in advance everyone for your help.

I am trying to figure out if it's possible to use a cursor row record or equivalent with cursor variables to ease the coding necessary to insert and update tables. Below is my pseudo-code for what I'd like to do, but which to this point haven't figured out how to do it.

create or replace procedure test
is

	cursor cur is select * from table_A;
	cv cur%ROWTYPE;

begin
	for cv in cur loop
		insert into TABLE_B values( CV ); -- somehow use the
cv row to supply all the values
without doing a cv.field1 , cv.field2 etc. , but do it automatically all at once.

        end loop;
end;
/

I would also like a way to accomplish a similar thing for updates, as in:

	update TABLE_B insert cv where current of table_A;  OR
	update table_A insert cv where current of table_A;
In the first one I am assuming that table_A and TABLE_B have exactly the same columns, etc.

I would think there would be a way to take advantage of the fact that Oracle already houses all the columns in the above "cv" rowtype. I would like think they have a simple way to utilize all the values for the columns all at once.

Does any one know how to do this?

Thanks again,

Ken Sproule
kenmn_at_tds.net Received on Mon Mar 27 2000 - 08:02:09 CST

Original text of this message

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