1. 创建sequence:
相关操作代码如下:
CREATE SEQUENCE SEQU_DATA_DATAINFO INCREMENT BY 1 START WITH 1 NOCYCLE NOCACHE NOORDER;
2. 创建触发器:
相关操作代码如下:
create or replace TRIGGER TRIG_TEST
BEFORE INSERT ON TABLE1
FOR EACH ROW
DECLARE
tmpVar NUMBER;
BEGIN
tmpVar := 0;
Select SEQU_PROC_ASSOCIATEINFO.NextVal into tmpVar from dual;
:new.procid:=tmpVar;
EXCEPTION
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END;
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。