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: John Russell <netnews7_at_johnrussell.mailshell.com>
Date: Thu, 28 Aug 2003 04:52:16 GMT
Message-ID: <6c2rkv88msdjt4r6dgj5bm86lqcvnfcvte@4ax.com>


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?

These days (i.e. 9.2), you can insert a PL/SQL record without specifying all the column names:

http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#34340

So you could declare a %ROWTYPE record, SELECT INTO it, change the one field, and then INSERT the record as a new row.

John

--
Photo gallery: http://www.pbase.com/john_russell/
Received on Wed Aug 27 2003 - 23:52:16 CDT

Original text of this message

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