Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SLQ question
Well, you either have to type (or copy-paste) all the columns (as in VALUES (tmp_row.col1, tmp_row.col2,...)) or you could build the insert command as a string, reading from user_tab_columns, and executing the string as a dynamic sql statement. See dbms_sql for more info. This may be harder than just doing the copy-paste thing. If you have a decent editor, the copy-paste won't take very long.
Anders Blaagaard <blaa_at_ifad.dk> wrote in article
<3427AA2F.5354D5A8_at_ifad.dk>...
> I have a table with more than 100 columns, and a want to make a copy of
> a row, change a few fields, a put it back into the table (without
> changing the original). The idea is this:
> declare
> tmp_row table_name%rowtype;
> begin
> select * into tmp_row from table_name where ...
> tmp_row.field37 := ..
> tmp_row.field98 := ..
> insert into table_name values (tmp_row); -- ILLEGAL
> end;
> Can anyone think of an easy way to do this?
> Anders Blaagaard
> blaa_at_ifad.dk
Received on Tue Sep 23 1997 - 00:00:00 CDT
![]() |
![]() |