首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

oracle int从增长

2012-08-15 
oracle int自增长1. 先建表(此处略去)2. 创建Sequencecreate sequence template_seqstart with 1increment

oracle int自增长
  1. 先建表(此处略去)
  2. 创建Sequence
 

  create sequence template_seq  start with 1  increment by 1  nocycle  cache 99999  

  3.创建触发器
 
create trigger template_trig beforeinsert on template for each row--template是表名declarenextid number;beginif:new.templateid is null or :new.templateid=0 then--templateid是template表的列select template_seq.nextval into nextid from sys.dual;:new.templateid:=nextid;end if;end;

热点排行