drop table INSTITUTION_CATEGORY;
create table INSTITUTION_CATEGORY(
ID number(5) not null primary key,
NAME varchar2(50) not null,
PARENT_ID number(5),
IS_VALID varchar2(2) default '1',
CREATE_DATE TIMESTAMP(6),
CREATER varchar2(20)
);
drop sequence INSTITUTION_CATEGORY_SEQUENCE;
create sequence INSTITUTION_CATEGORY_SEQUENCE
minvalue 1
maxvalue 999999999
start with 1
increment by 1
cache 20;
create or replace trigger INSTITUTION_CATEGORY_TRIGGER
before insert on INSTITUTION_CATEGORY /*触发条件*/
for each row /*对每一行都检测是否触发*/
begin /*触发器开始*/
select INSTITUTION_CATEGORY_SEQUENCE.nextval into :new.ID from dual;
/*触发器主题内容,即触发后执行的动作,在此是取得INSTITUTION_CATEGORY_SEQUENCE序列下一个值插入到表ID字段中*/
end;