Triggers and Stored Procedures - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

Stored procedures called from within a triggered action statement can be one or more of the SQL statements summarized in the following table:

Trigger Type Valid Statement
AFTER
  • ROLLBACK
  • SELECT AND CONSUME
  • UPDATE (all forms)
  • EXEC of macros that contain valid SQL statements
BEFORE
  • SET clause (INSERT and UPDATE row triggers only).
  • EXEC of macros that contain no data-changing SQL statements

Triggered statements must run within the same transaction as the statement that fires their trigger. Stored procedures can change the state of a transaction, but the statements within the body of a trigger cannot change the transaction state.

Running the SQL CALL statement does not initiate a transaction. Running the first SQL request or expression inside the stored procedure initiates a transaction. The system assigns the request a request number and, if not already assigned, a transaction number. The system then increments the request number for each SQL request inside the stored procedure. However, the transaction number of the SQL requests depends on the session mode and the status of the transaction in which the CALL request was submitted.

For this reason, the following statements are not permitted inside the body of any stored procedure that is called from a trigger:

  • All DDL statements
  • All DCL statements
  • The BEGIN TRANSACTION and END TRANSACTION statements
  • All exception handling statements

    Although a stored procedure called by a trigger can contain condition handlers, most condition handlers never run when the procedure is called because the first failure on a triggered statement causes the entire request to end and roll back.

Stored procedures support the following three types of parameters:
  • IN
  • OUT
  • INOUT

However, because triggered actions cannot return output to the requestor, the OUT and INOUT parameters are not allowed in any stored procedure that is called from a trigger.

You can pass the old-values correlation name and the new-values correlation name as parameters, but not the old-values-table alias, new-values-table alias, or old-new-table alias.