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

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;

 

posted on 2014-11-15 15:02  相约future  阅读(243)  评论(0编辑  收藏  举报