Home » SQL & PL/SQL » SQL & PL/SQL » help!
help! [message #2763] Mon, 12 August 2002 07:22 Go to next message
keane
Messages: 23
Registered: June 2002
Junior Member
i have a table which is one more column than an existing view, like the followings
table mv_v1(col_1 number(5), col_2 number(5));
view v1(col_1 number(5))

I want to copy all records in the views to the table with the value of col_2 to be '111'.
I don't want to use the following, because it uses col_1 explicitly. Can we do it without the using col_1 explicitly.
procedure copy_data() as
cursor c is select * from v1;
begin
for rec in c loop
insert into mv_v1 values(rec.col_1, 111);
end loop;
end;

keane
Re: help! [message #2764 is a reply to message #2763] Mon, 12 August 2002 08:31 Go to previous messageGo to next message
Travis
Messages: 15
Registered: March 2001
Junior Member
update v1 set column2 = 111;
Re: help! [message #2768 is a reply to message #2763] Mon, 12 August 2002 09:36 Go to previous message
ga
Messages: 7
Registered: June 2002
Junior Member
you can do the following:

insert into mv_v1 select v1.*, '111' from v1;

<<>>
Previous Topic: PLS-00414: no column ... in table
Next Topic: Query to select PK. / how to insert and update CLOB?
Goto Forum:
  


Current Time: Thu Mar 28 15:34:44 CDT 2024