第一步:创建SEQUENCE create sequence s_country_id increment by 1 start with 1 maxvalue 999999999; 第二步:创建一个基于该表的before insert 触发器,在触发器中使用该SEQUENCE create or replace trigger bef_ins_t_country_define before insert on t_country_define referencing old as old new as new for each row begin new.country_id=s_country_id.nextval; end;
相信bzszp(SongZip) 吧, 我以前问过一样的问题,就是他那样解决的。
序列(SEQUENCES)1、定义序列 CREATE SEQUENCES 序列名 INCREMENT BY n /* 步长 START WITH n /* 起始值 MINVALUE n | NOMINVALUE /* 是否设最小值,最小值N MAXVALUE n | NOMAXVALUE /* 是否设最大值,最大值N CYCLE | NOCYCLE /* 到达最大值后是否循环使用 CACHE n | NOCACHE /* 把下N个序列值2、使用序列 INSERT INTO AA(ID) VALUES(序列名.NEXTVAL);
呵呵, bzszp(SongZip) 兄,给你挑点错误: create or replace trigger bef_ins_t_country_define before insert on t_country_define for each row begin :new.country_id := s_country_id.nextval; end; /
呵呵, bzszp(SongZip) 兄,给你挑点错误: create or replace trigger bef_ins_t_country_define before insert on t_country_define for each row begin :new.country_id := s_country_id.nextval; end; /
呵呵, bzszp(SongZip) 兄,给你挑点错误: create or replace trigger bef_ins_t_country_define before insert on t_country_define for each row begin :new.country_id := s_country_id.nextval; end; /
create sequence s_country_id increment by 1 start with 1 maxvalue 999999999;
第二步:创建一个基于该表的before insert 触发器,在触发器中使用该SEQUENCE
create or replace trigger bef_ins_t_country_define
before insert on t_country_define
referencing old as old new as new for each row
begin
new.country_id=s_country_id.nextval;
end;
我以前问过一样的问题,就是他那样解决的。
CREATE SEQUENCES 序列名
INCREMENT BY n /* 步长
START WITH n /* 起始值
MINVALUE n | NOMINVALUE /* 是否设最小值,最小值N
MAXVALUE n | NOMAXVALUE /* 是否设最大值,最大值N
CYCLE | NOCYCLE /* 到达最大值后是否循环使用
CACHE n | NOCACHE /* 把下N个序列值2、使用序列
INSERT INTO AA(ID) VALUES(序列名.NEXTVAL);
create or replace trigger bef_ins_t_country_define
before insert on t_country_define
for each row
begin
:new.country_id := s_country_id.nextval;
end;
/
create or replace trigger bef_ins_t_country_define
before insert on t_country_define
for each row
begin
:new.country_id := s_country_id.nextval;
end;
/
create or replace trigger bef_ins_t_country_define
before insert on t_country_define
for each row
begin
:new.country_id := s_country_id.nextval;
end;
/