码迷,mamicode.com
首页 > 其他好文 > 详细

创建触发器在表中播入数据时ID自动增长

时间:2014-11-15 15:26:57      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   sp   for   数据   div   on   

create table ttt (id number primary key ,name varchar2(20),age number(2))


create or replace trigger gger_tt 
before insert on ttt
for each row
  when (new.id is null)
    begin
      select ttt_sequence.nextval into :new.id from dual;
      end;

 

创建触发器在表中播入数据时ID自动增长

标签:style   blog   color   ar   sp   for   数据   div   on   

原文地址:http://www.cnblogs.com/tianmingt/p/4099325.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!