序列
– Create sequence
create sequence SEQ_MKDD_ZPWSBFJHTY_ID
minvalue 1
maxvalue 999999999
start with 1
increment by 1
cache 20;
触发器
CREATE OR REPLACE TRIGGER “MKDD_ZPWSBFJHTY_TIGGER” BEFORE INSERT ON “MKDD_ZPWSBFJHTY” REFERENCING OLD AS “OLD” NEW AS “NEW” FOR EACH ROW DECLARE
NEXTID NUMBER;
BEGIN
IF :NEW.ID IS NULL OR :NEW.ID=0 THEN
SELECT SEQ_MKDD_ZPWSBFJHTY_ID.NEXTVAL INTO NEXTID FROM DUAL;
:NEW.ID:=NEXTID;
END IF;
END;