zoukankan      html  css  js  c++  java
  • Oracle中的触发器

    创建触发器的语法:

    Create trigger 触发器的名字
    after insert/update/delete/(select是没有触发器的)
    on 表名字
    declare
    
    begin
    
    dbms_output.put_line("使用触发器打印一句话");
    
    
    end;
    /

    语法明细:

    CREATE [or REPLACE] TRIGGER 触发器的名字
    
    {BEFORE | AFTER}
    
    {DELETE| UPDATE | INSERT}
    
    ON 表名
    
    {FOR EACH ROW (WHERE条件)}
    
    PL/SQL块

    触发器创建完毕,在插入数据的时候出现如下错误:

    在行: 12 上开始执行命令时出错 -
    insert into emp(empno,ename,sal,deptno) values(1001,'Jack',50000,10)
    错误位于命令行: 12 列: 13
    错误报告 -
    SQL 错误: ORA-04098: 触发器 'SCOTT.SAYNEWEMP' 无效且未通过重新验证
    04098. 00000 -  "trigger '%s.%s' is invalid and failed re-validation"
    *Cause:    A trigger was attempted to be retrieved for execution and was
               found to be invalid.  This also means that compilation/authorization
               failed for the trigger.
    *Action:   Options are to resolve the compilation/authorization errors,
               disable the trigger, or drop the trigger.

    问题解决参考文章:http://xuehu2009.iteye.com/blog/445403

  • 相关阅读:
    Codeforces Round #218 (Div. 2) C题
    Codeforces Round #217 (Div. 2) c题
    求组合数
    hdu 4539(状态压缩dp)
    poj 2923(状态压缩dp)
    项目管理
    java 实现单向链表
    sql
    设计模式
    自己写了一个解析json为table的工具类
  • 原文地址:https://www.cnblogs.com/blogofwyl/p/4854175.html
Copyright © 2011-2022 走看看