为了账号安全,请及时绑定邮箱和手机立即绑定

触发器没有效果

create or replace trigger securityemp before insert on emp begin  if to_char(sysdate,'day') in ('星期六','星期天') or    to_number(to_char(sysdate,'hh24')) not between 9 and 18 then    --禁止insert新员工    raise_application_error(-20001,'禁止在非工作时间插入新员工'); end if; end; 为什么我用PL/SQL工具编写触发器后,插入语句没有任何效果呢?


http://img1.sycdn.imooc.com//6030cf22000108dd11000522.jpg

正在回答

1 回答

create or replace trigger no_time_newdate before insert on unifier_uxqa0401

begin

  if to_char(sysdate,'day') in('saturday','sunday') or to_number(to_char(sysdate,'hh24')) not between 9 and 18

    --禁止insert

    raise_application_error(-20001,'非工作时间禁止写入');

    end if;

end ;

我是这样写的,亲测有效

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Oracle触发器
  • 参与学习       36823    人
  • 解答问题       49    个

满足条件自动执行的触发器,教程涉及4个案例讲解触发器的应用

进入课程

触发器没有效果

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信