读书人

用触发器在insert前作检查 如不满足条

发布时间: 2012-09-25 09:55:58 作者: rapoo

用触发器在insert前做检查 如不满足条件则停止insert操作

可以使用instead of触发器,替代原先的插入操作,该语法仅适用于视图,故为实体表建立一个一样的视图。在符合条件时,insert到实体表中,不符合条件,则不做操作:

  CREATE OR REPLACE TRIGGER TR_v_information    INSTEAD OF insert on v_information    for each row  BEGIN    if INSTR('关键字', :new.newstitle) <= 0 then      begin        insert into information          (newstitle)        values          (:new.newstitle);      end;    end if;  END TR_v_information;
?

读书人网 >其他数据库

热点推荐