首先建立乙個索引,然後建立乙個觸發器
索引的名字: seq_tproduct
觸發器的名字: addid
表名:tproduct
自增列名:pid
create sequence seq_tproduct
minvalue 1
start with 1
increment by 1
nocache;
create or replace trigger addid
before insert on tproduct
for each row 51testing
begin
select seq_tproduct.nextval into :new.pid from dual;
end;
Oracle主鍵自增的解決辦法
首先,要建立乙個表 create table userinfo userid int not null primary key,username varchar 20 not null,password varchar 20 not null,varchar 4 age int 然後,建立乙個序列 ...
Oracle自增ID實現
首先,建立一張表 create table example id number 4 not null primary key,name varchar 25 然後,自定義乙個序列 sequence create sequence example sequence increment by 1 每次加...
oracle 實現id自增
首先,建立一張表 create table example id number 4 not null primary key,name varchar 25 然後,自定義乙個序列 sequence create sequence example sequence increment by 1 每次加...