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 a record within a table

Re: copying a record within a table

From: lam <mailbox_at_online.de>
Date: 2000/05/14
Message-ID: <391DD3F7.F49EBB93@online.de>#1/1

The tough way (and that is only one I have now) is: query USER_TAB_COLUMNS for all the column name of your table and query USER_INDEX_COLUMNS (sth similar) to exclude the primary key columns. Once all the columns except the primary keys are determined, you can issue the INSERT statement. All this done with dynamic SQL, you do not have to hardcode any column name! You could even parameterize the table name!

mmembrino_at_my-deja.com schrieb:

> I would like to make a copy of a record and only change the primary
> key. I do not want to list every column, because if the table changes,
> then I will have to modify my stored proc.
> For example, I do not want to do the following:
> insert into customer
> select sq_cust.nextval, name, first_name
> from customer
> where customer_nbr = 12;
>
> I would like to use this in a Stored Proc.
>
> Thanks in advance
> Mark
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
To reply to me via email, please substitute the text no_spam with mailbox
in the return address.
Received on Sun May 14 2000 - 00:00:00 CDT

Original text of this message

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