让oracle实现自增字段
先建序列,然后建立一个触发器实现!
cata0是表名,cata0_id是需要自增的字段!
CREATE SEQUENCE SEQ_cata0
INCREMENT BY 1
START WITH 1
MAXVALUE 9999999
CREATE TRIGGER TRG_cata0 BEFORE
INSERT ON cata0
FOR EACH ROW begin
SELECT SEQ_cata0.NEXTVAL
INTO :NEW.cata0_ID
FROM DUAL;
End TRG_cata0;