REFERENCING OLD AS OLD NEW AS NEW FOR EACH Row
CREATE OR REPLACE TRIGGER TRI_DELETE_INFO AFTER DELETE ON T_INFO_2012 REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE V_SQLERRM VARCHAR2(200); BEGIN DELETE FROM T_INFO_2013 WHERE CODE = :OLD.CODE; --COMMIT; 触发器中不可以使用COMMIT; EXCEPTION WHEN OTHERS THEN V_SQLERRM := '触发器 TRI_DELETE_INFO 出错:' || SQLERRM; INSERT INTO PROCEDURE_LOG (ERRMSG, ERRDATE) VALUES (V_SQLERRM, SYSDATE); END;
1、For each row的意义是:在一次操作表的语句中,每操作成功一行就会触发一次;不写的话,表示是表级触发器,则无论操作多少行,都只触发一次;
2、REFERENCING OLD 和 REFERENCING NEW 的含义不同,具体取决于触发器是行级还是语句级触发器。对于行级触发器,REFERENCING OLD 子句允许引用更新或删除之前行中的值,REFERENCING NEW 子句允许引用已插入或更新的值。在 BEFORE 和 AFTER 触发器中可以引用 OLD 和 NEW 行。REFERENCING NEW 子句允许在插入或更新操作发生之前在 BEFORE 触发器中修改新行
3、:NEW 和:OLD使用方法和意义,new 只出现在insert和update时,old只出现在update和delete时。在insert时new表示新插入的行数据,update时new表示要替换的新数据、old表示要被更改的原来的数据行,delete时old表示要被删除的数据。
begin前面出现的new,old不加冒号,begin和end之间出现的new和old都要在前面加上":"。
REFERENCING OLD AS OLD NEW AS NEW
这样写之后就可以在begin end直接直接使用别名来引用。
相关推荐
触发器相关语句详细说明:查看触发器作用于哪张表
[REFERENCING {OLD [AS] old | NEW [AS] new| PARENT as parent}] [FOR EACH ROW ] [WHEN condition] trigger_body; 其中: BEFORE 和AFTER指出触发器的触发时序分别为前触发和后触发方式,前触发是在执行触发事件...
触发器是与表有关的数据库对象,在对表进行insert/update/delete之前或之后,会触发并执行触发器中定义的SQL语句。触发器的这种特性可以协助应用在数据库端确保数据的完整性,记录日志,校验数据等。
CREATE or replace TRIGGER T_userupdateT BEFORE update ON T_user REFERENCING OLD AS old NEW AS N_ROW FOR EACH ROW DECLARE U_xtfidemp1 varchar(36); u_xtempcode1 varchar(20); u_xtempcodeCount int:=0; ...
功能: 1、 允许/限制对表的修改 2、 自动生成派生列,比如自增字段 3、 ...id on employees referencing old as old_value new as new_value for each row when (new_value.department_id<>80 ) begin :new_value
另外一个简单介绍线性参考基本知识的PPT 理论与例子相结合~~ 对大家学习很有帮助~~
大部分数据库语句的基本语法是... REFERENCING NEW AS N_ROW //把新插入的数据命名为N_ROW FOR EACH ROW MODE DB2SQL //每一行插入数据都出发此操作 BEGIN ATOMIC //开始 DECLARE U_xtfidemp1 varchar(36); //定义变量
This is a guide to the Harvard author-date referencing system. It is based on the following manual: Commonwealth of Australia 2002, Style manual for authors, editors and printers, 6th edn, rev. by ...
一个介绍线性参考基本知识的PPT 理论与例子相结合~~ 对大家学习很有帮助~~
This library is distributed as Android library project so it can be included by referencing it as a library project. https://bintray.com/filestack/maven/filepicker-android If you use Maven, you can in
Linear Referencing and Dynamic Segmentation in ArcGIS, 动态分段方面的资料,外文的.
Harvard Referencing这个版本相当的权威,有助于大家参考如何写reference
this is targetlink exercise files for model_referencing
文献查询及索引information searching and referencing
constant speeches referencing microservices. This modern engineering technique has grown from good old SOA (Service Oriented Architecture) with features like REST (vs. old SOAP) support, NoSQL ...
Referencing using the Harvard author-date 是科技工作者发表论文必须要掌握的要点,大名鼎鼎不多说了。
muRF 是一种突出显示文档的方法,以提供有关源质量的信息,与斜体强调的方式非常相似。 想想维基百科。 开发是 Firefox 插件和相关的服务器应用程序。
java运行依赖jar包
is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use ...
The requirements include standard image referencing behavior, operations, responses, events, device properties, datasets, and data formats to ensure interoperability. This standard also ...