-- create a sequence to manage the primary keys
create sequence key_sequence;
-- i don't know what data you want in your table
create table tempTable (
myKey int primary key,
myValue varchar(12))
-- create four rows of arbitrary data, they will get primary keys of 1,2,3 and 4
insert into tempTable values (key_sequence.nextval, 'eggs')
insert into tempTable values (key_sequence.nextval, 'bacon')
insert into tempTable values (key_sequence.nextval, 'chips')
insert into tempTable values (key_sequence.nextval, 'salad')
-- you can see the 4 rows
select * from tempTable
-- select all four rows (as no where clause) and re-insert them into the table
-- the sequence will take care of allocating new primary keys
insert into tempTable
select key_sequence.nextval, myValue
from tempTable
-- now you can see eight rows in the table
select * from tempTable
YS를 희망하지만 당신은 UR PK 만드는 논리와 테이블 스키마 – Zia
를 표시해야합니다, 당신 시퀀스를 사용하고 sequence_name으로 PK를 생성 할 수 있습니다 .NEXTVAL –