oracle自增字段的序列和触发器

create sequence seq_tablename  
increment by 1  
start with 1
nonmaxvalue
nocycle


CREATE OR REPLACE TRIGGER BeforeTestCreate2Insert
BEFORE INSERT ON trig_tablename
FOR EACH ROW
BEGIN
SELECT seq_tablename.nextval INTO :new.id  FROM dual;
END;

你可能感兴趣的:(oracle)