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 -> Re: How to duplicate many rows from SQL

Re: How to duplicate many rows from SQL

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Tue, 15 Jun 1999 15:07:13 +0100
Message-ID: <929455931.20476.0.nnrp-13.9e984b29@news.demon.co.uk>


And with Oracle 8 you could do

    insert /*+ Append */

for a fast, no-logging insert above the high water mark - so long as you were prepared to ignore the risk of leaving the data unrecoverable for a while.

--

Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk

Manu wrote in message <7k5iof$21u$1_at_oceanite.cybercable.fr>...
>Try this :
>
>insert into emp (emp_type, col2, col3, col4 etc.)
>(
> select '321', col2, col3, col4 etc
> from emp
> where salary > 9000);
>
>
>
>
>
>Stephen Jackson,SL/BI a écrit dans le message
<37664956.8BCD0443_at_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 - 09:07:13 CDT

Original text of this message

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