Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Working with sequence for generating PK
I use sequence for creating my pk's but when i'm uploading data in some
tables without using sequence (i force my owne pk) i have some problem when
the sequence is equal to a number that exist in the table.
Is it possible to skip a number that already exist in the table?
i use a trigger like this one :
CREATE OR REPLACE TRIGGER GENCLIENTTYPEID
BEFORE INSERT ON RMSCLIENTTYPE
REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
BEGIN
SELECT seq_ClientTypeID.nextval
INTO :new.ClientTypeID FROM dual;