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

Home -> Community -> Usenet -> c.d.o.server -> How to duplicate many rows from SQL

How to duplicate many rows from SQL

From: Stephen Jackson,SL/BI <Stephen.Jackson_at_cern.ch>
Date: Tue, 15 Jun 1999 14:38:47 +0200
Message-ID: <37664956.8BCD0443@cern.ch>

    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

Original text of this message

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