Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle SQL - Help on copying record to same table with different value for primary key

Oracle SQL - Help on copying record to same table with different value for primary key

From: Dennis Valente <Dennis.Valente_at_nau.edu>
Date: 15 Apr 2002 16:29:25 -0700
Message-ID: <f5e6c422.0204151529.4258deed@posting.google.com>


Here is my table:

CREATE TABLE tblPerson (
ProjectYear varchar2(4),
ProjectNumber varchar2(4),
ModificationNumber varchar2(3),
Description varchar2(4000),
Primary Key (ProjectYear,ProjectNumber,ModificationNumber));

I want to be able to copy a record with a certain primary key value and insert into the same table with a different primary key value.

I.E. (2002,0001,001,'This is a short project.')

     (2002,0001,002,'This is a short project.')

A simple INSERT statement will normally do, however, I will have many tables like this one with the same primary key fields but different additional columns. I will be looping through a list of tablenames that will be predefined. Only the primary key columns will be the same, all other columns will vary. Inotherwards, I can not hardcode the columns for the INSERT statement.

Any help would be greatly appreciated. Received on Mon Apr 15 2002 - 18:29:25 CDT

Original text of this message

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