VALUES statement
The VALUES statement provides a method for invoking a user-defined function from a trigger. Transition variables and transition tables can be passed to the user-defined function.
Invocation for VALUES
This statement can only be used in the triggered action of a basic trigger.
VALUES followed by a sequence-reference is a values-clause, which is a form of fullselect. For information about invocation of the values-clause, see fullselect.
Authorization for VALUES
Authorization is required for any expressions that are used in the statement. For more information, see Expressions.
Syntax for VALUES
Description for VALUES
- VALUES
- Specifies
one or more expressions. If more than one expression is specified,
the expressions must be enclosed within parentheses.
- expression
- Any expression of the type described in Expressions. The expression must not contain a host variable.
If a user-defined function is specified as part of an expression, the user-defined function is invoked. If a negative SQLCODE is returned when the function is invoked, Db2 stops executing the trigger and rolls back any triggered actions that were performed.
Example for VALUES
CREATE TRIGGER EMPISRT1
AFTER INSERT ON EMP
REFERENCING NEW AS N
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
VALUES(NEWEMP(N.EMPNO, N.LASTNAME, N.FIRSTNAME));
END