• Home
  • Testing
  • SAP
  • Web
  • Must Learn!
  • Big Data
  • Live Projects
  • Blog

What is Trigger?

A trigger is also a stored procedure that automatically executes when an event happens on a given table or view.

The database users only having the TRIGGER privilege for the given <subject_table_name> are allowed to create a trigger for that table or view.

The CREATE TRIGGER command defines a set of statements that are executed when a given operation (INSERT/UPDATE/DELETE) takes place on a given subject table or subject view.


Syntax

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

ELEMENTS DESCRIPTION
<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.

 

YOU MIGHT LIKE:
SAP-HANA

SAP HANA Reporting

We have till now loaded data from SAP Source, Non-SAP, and Flat file through SAP SLT, SAP BODS and...