//用序列和触发器实现ID自增
//1 创建序列
create sequence 序列名 increment by 1 start with 1 maxvalue 9999999999999999999999999999 nocycle cache 20;
//2 创建触发器
create or replace trigger 触发器名
before insert on 表名
for each row when (new.字段名 is null)
begin
select 序列名.nextval into:new.字段名 from dual;
end;
//用序列和触发器实现ID自增
//1 创建序列
create sequence TEST_DPI_RULES_ID increment by 1 start with 1 maxvalue 9999999999999999999999999999 nocycle cache 20;
//2 创建触发器
create or replace trigger TEST_ID_TRIGGER
before insert on TEST_DPI_RULES
for each row when (new.RULE_ID is null)
begin
select TEST_DPI_RULES_ID.nextval into:new.RULE_ID from dual;
end;