首先创建好表,主键
创建sequence(sequence与表空间同级)
create sequence sequence名字 minvalue 1 maxvalue 99999999999999
increment by 1
start with 1;
创建表触发器 trigger
create or replace trigger trigger名字
BEFORE INSERT ON 表的名字
FOR EACH ROW
BEGIN
SELECT sequence名字.Nextval INTO :NEW.主键名字 FROM dual;
END;