(這幾天做了個小小課程設計時用的是oracle數據庫
用慣sql server 或 mysql 的同志們都知道
沒事
先創建一個序列
[sql]
CREATE SEQUENCE SEQU_FANGWUXINXI_AUTOINC
MINVALUE
MAXVALUE
INCREMENT BY
START WITH
nocache;
再創建一個觸發器
[sql]
create or replace
trigger TRIG_FANGWUXINXI_AUTOINC
before insert on fangwuxinxibiao
for each row
declare
nextid number;
begin
IF :new
select SEQU_FANGWUXINXI_AUTOINC
:new
end if;
end;
From:http://tw.wingwit.com/Article/program/Oracle/201311/18885.html