Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> TRIGGER code for an auto-incrementing field?
This has to be basic, basic but as beginner, I am having trouble.
I want to implement an autoincrementing field in a table, and as it can updated via ODBC, I need to do this with a TRIGGER.
I created a sequence and tried a trigger of:
CREATE OR REPLACE TRIGGER "RESLIB"."NEWID" BEFORE INSERT ON
"RESLIB"."P_Well"
BEGIN
:new.ID := PW.NEXTVAL;
END;
However I get "NEWID" fails on revalidation when running it.
Where did I go wrong?
Work: PO Box 30368, Lower Hutt Home: 55 Buick St, Petone, Lower Hutt New Zealand ph +64 (04) 569-9059, fax (04) 569 5016 ph (04) 568-7190,Received on Tue Oct 28 1997 - 00:00:00 CST