Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Using Sequence and Trigger for Unike fields
Hi,
I am trying to create a sequence and a trigger to make afield in my table kind of auto increment. every time a new record is created, a nuw id is inserted in the id field. I got tthe Sequence going easilly but I can't seem to be able to create a Trgger without getting the following error:
MGR-00073: Warning: TRIGGER ¨se.css_user created with compilation errors
The following code is run:
DROP SEQUENCE "CSS_User"."USRID_SEQ" ;
CREATE SEQUENCE "CSS_User"."USRID_SEQ"
INCREMENT BY 1 NOMAXVALUE MINVALUE 1
NOCYCLE CACHE 20 NOORDER ;
CREATE OR REPLACE TRIGGER "CSS_User".UserAccess_Bit
BEFORE INSERT ON "CSS_User"."USERACCESS"
FOR EACH ROW
BEGIN
IF (:new.usrid IS NULL) THEN
:new.usrid := USRID_SEQ.next_val
end ;
Please can you help ?
Eric
eric_at_jodoin.com
Received on Mon Jul 13 1998 - 03:46:03 CDT
![]() |
![]() |