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: PL/SQL question re inserts

Re: PL/SQL question re inserts

From: Pomme-granite <pg_at_pg.co.uk>
Date: Wed, 27 Aug 2003 15:31:58 +0100
Message-ID: <fofpkv8sgdmik1eek4q6mrhsr9bc8diuf0@4ax.com>


You can use insert into select..

insert into MyTable select <newKey>, Afield1, AField2..., Afieldn from MyTable where MyKey = <oldKey>;

Simply specify your oldKey and newKey values and remember the select columns must match the MyTable columns.

Hope this helps.
Pomme-granite

On 27 Aug 2003 04:42:37 -0700, johnleslie_at_madasafish.com (John Leslie) wrote:

>Not sure if this is the correct forum for this question, but here
>goes.
>
>I want create a new row in a table which is identical to an existing
>row except for the key value.
>
>Is there an easy way to do this using the Insert statement, rather
>than reading and storeing the original record and then specifying each
>value for the insert statement?
>
>JL
Received on Wed Aug 27 2003 - 09:31:58 CDT

Original text of this message

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