Undoing a sequence increment with autonumbering
From: Knut Hovda <knut.hovda_at_pti.no>
Date: 5 Feb 2003 07:52:55 -0800
Message-ID: <787c1a4a.0302050752.3a532d9_at_posting.google.com>
/
Date: 5 Feb 2003 07:52:55 -0800
Message-ID: <787c1a4a.0302050752.3a532d9_at_posting.google.com>
Hello,
If there a way to undo or avoid a sequence increment if the insert statement failed?
The code I'm currently using is:
F_ID number(16) NOT NULL PRIMARY KEY, NAME varchar2(30) NOT NULL UNIQUE);
CREATE SEQUENCE FieldSeq;
CREATE OR REPLACE TRIGGER FieldTrig
BEFORE insert ON Field
FOR EACH ROW
begin select FieldSeq.nextval into :new.F_ID from dual; end;
/
In advance, thanks for your help.
Knut Hovda (knut.hovda_at_pti.no) Received on Wed Feb 05 2003 - 16:52:55 CET