日期:2014-05-17 浏览次数:20957 次
create or replace trigger Goods_trigger
before insert on wz_Goods
for each row
begin
select Goods_SEQ.nextval into :NEW.good_id from dual;
end;
把里面的tab_simo 改成你的 表名。
create or replace trigger ins_tab_simo
before insert on tab_simo for each row
declare is_has number;
begin
select count(*) into is_has from tab_simo where id = :new.id;
if is_has = 0 then
DBMS_OUTPUT.PUT_LINE('new record');
else
update tab_simo set id = id+1
where id >= :new.id;
end if;
end;