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: Copying rows

Re: Copying rows

From: Takahiro Tanaka <tanakat_at_cenv.canon.nl>
Date: 1998/12/17
Message-ID: <75ajeg$pca$1@news2.xs4all.nl>#1/1

Hi,

How will you use trigger or snapshot table for this metter?

Morten Bråten wrote in message <3678CAC1.85823AF2_at_statoil.com>...
>I have a table with 15-20 columns. The first column is the
>primary key, which I use a sequence to generate.
>
>I want to copy n number of rows from the table and append
>them to the same table. The copied rows must get a new
>sequence number, since the primary key definition doesn't
>allow duplicates.
>
>I can probably use something like
>INSERT INTO table (keyfield, field2, field3, field4,..., fieldn)
>VALUES (SELECT sequence.nextval, field2, field3, field4, ..., fieldn
>FROM table WHERE ...)
>
>But the problem is that my table structure is subject to
>frequent changes, and I would have to update the copy query/procedure
>each time
>I changed the table. I'm looking for a way to programmatically get the
>column names,
>and make a generic (PL/SQL) procedure that copies all fields (except the
>primary key, which is filled in by the sequence) to a new row.
>
>Can anybody help me with this?
>
>- Morten
>
>
Received on Thu Dec 17 1998 - 00:00:00 CST

Original text of this message

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