在Oracle怎样用将主键ID设置为自动增加
序列
create sequence FIXED_ASSETS_TYPE_SE minvalue 1 maxvalue 9999999999999999999999999999 start with 1 increment by 1 nocache;
触发器
create or replace trigger FIXED_ASSETS_TYPE_TRI before insert on FIXED_ASSETS_TYPE for each row begin select FIXED_ASSETS_TYPE_SE.nextval into :new.TYPE_ID from dual; end FIXED_ASSETS_TYPE_TRI;
增加记录
INSERT INTO FIXED_ASSETS_TYPE(PARENT_ID,TYPE_NAME,DEL_FLAG) Values(1,'沙发',0);
//查询
select * from fixed_assets_type;