Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to duplicate many rows from SQL
Hi,
Here's my problem. I want to duplicate create a new set of records, based
on an existing set of records, but changing one field so as not to violate a
constraint.
So far, the only solution I have (which works) is the following:
create table temp_table as select * from emp where salary >9000;
update temp_table set emp_type = 321;
insert into emp select * from temp_table;
drop table temp_table;
This copies the data I want to duplicate into a temp table, changes it
appropriately, then copies it back to the original table.
Is there a better way of doing this from SQL?
Cheers,
Stephen Jackson
If you reply via eMail, please send to Stephen.Jackson_at_cern.ch Received on Tue Jun 15 1999 - 07:38:47 CDT