SELECT statements embedded in user-defined routines

A select trigger that is defined on a SELECT statement embedded in a user defined routine (UDR) executes a triggered action in the following instances only:
  • The UDR appears in the select list of a SELECT statement
  • The UDR is invoked with an EXECUTE PROCEDURE statement
Suppose you create a routine new_proc that contains the statement SELECT col_a FROM tab_a. Each of the following statements executes a triggered action on the hits_trig trigger for each instance of a row that the embedded SELECT statement returns:
SELECT new_proc() FROM tab_b;
EXECUTE PROCEDURE new_proc;