Copying a row in the same table without having to type the 50+ column names (while changing 2 columns)

During my job, I usually have to copy rows while changing their primary key and giving them a new stamp and maybe changing the foreign key.

The problem is I don't want to type all the column names while doing;

insert into table_name
select pk_seq.nextval, 
       'foreign-key', 
       col3,
       col4...col51
  from table_name
 where pk_id = "original_primary_key"

And if i do * in the select statement i won't be able to update the first 2 columns...

Is there any way to do how I want to do it?

28
задан OMG Ponies 23 September 2010 в 16:18
поделиться