标签:start sequence rem lov rom god with 创建 love
原文地址:https://www.cnblogs.com/godlovelian/p/5643996.html
前提:存在数据库di_test,主键为id。
1.创建一个索引sequence
create sequence di_test_id
minvalue 1
nomaxvalue
start with 1
increment by 1
nocache;
2.创建一个触发器。在插入数据之前触发
create or replace trigger trigger_di_test_insert
before insert on di_test
for each row
declare
-- local variable here
begin
-- Column "ID" uses sequence di_test_id
select di_test_id.nextval into :new.ID from dual;
end trigger_di_test_insert;
标签:start sequence rem lov rom god with 创建 love
原文地址:https://www.cnblogs.com/eyesfree/p/14955448.html