首页 > 数据库技术 > 详细

Oracle中的触发器

时间:2015-10-04 11:05:22      阅读:507      评论:0      收藏:0      [点我收藏+]

 

创建触发器的语法:

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

 

Oracle中的触发器

原文:http://www.cnblogs.com/blogofwyl/p/4854175.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!