zoukankan      html  css  js  c++  java
  • 触发器

    --触发器
    /*
    insert
    delete
    update

    类型:两种
    一种叫行级触发器
    表级触发器

    update t_student s set s.sname='1111' where s.sno=11111
    */
    CREATE OR REPLACE TRIGGER tg_test
    AFTER INSERT
    ON t_student
    BEGIN
    dbms_output.put_line('插入了一条数据 !');
    END;


    CREATE OR REPLACE TRIGGER tg_test_row
    AFTER UPDATE
    ON t_student
    BEGIN
    dbms_output.put_line('插入了一条数据 !');
    END;
    /*
    to_char(sysdate, 'day') not in ('星期六','星期日')
    to_char(SYSDATE, 'hh24') between 10 and 17
    */
    CREATE OR REPLACE TRIGGER checkforinsert
    BEFORE INSERT
    ON t_student

    BEGIN
    IF NOT (to_char(sysdate, 'day') not in ('星期六','星期日') AND to_char(SYSDATE, 'hh24') between 10 and 17) THEN
    raise_application_error(-20001, '非工作时间不能添加数据 !');
    END IF
    END;

  • 相关阅读:
    VueBlog
    java 代理模式
    集合框架
    面试题
    java 多线程
    网络编程
    HTTP
    MAVEN
    Redis高级
    深入浅出--梯度下降法及其实现
  • 原文地址:https://www.cnblogs.com/zhushijun/p/7101292.html
Copyright © 2011-2022 走看看