Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL question re inserts
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