首先创建一个索引,然后创建一个触发器
索引的名字: 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;