SAP HANA教程:创建触发器

2020-08-31 13:23发布


          点击此处--->   EasySAP.com 群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)

什么是触发器?

触发器也是一种存储过程,当给定表或视图上发生事件时,触发器将自动执行。

仅对给定的<subject_table_name>具有TRIGGER特权的数据库用户被允许为该表或视图创建触发器。

CREATE TRIGGER命令定义在给定主题表或主题视图上执行给定操作(INSERT / UPDATE / DELETE)时执行的一组语句。

句法

CREATE TRIGGER <TRIGGER_NAME> <trigger_action_time> <trigger_event_list>		 
     ON <subject_table_name> [REFERENCING <transition_list>] 
       [<for_each_row>] 
                 BEGIN 
                           [<trigger_decl_list>] 
                           [<proc_handler_list>] 
	             <trigger_stmt_list>		 
                 END

SYNTAX ELEMENTS

ELEMENTSDESCRIPTION
<trigger_name>It specifies the name of the trigger to be created, with the optional schema name.
<trigger_action_time>BEFORE | AFTER | INSTEAD OF

• BEFORE - Specifies that the trigger will be executed before the DML

Operation on a table. • AFTER - Specifies that the trigger will be executed after the DML operation

on a table. • INSTEAD OF - Specifies that the trigger will be executed instead of the DML

operation on a view. A view with INSTEAD OF trigger becomes updatable.

 


赞赏支持