Calling an External Stored Procedure From a Trigger - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantage™

An external stored procedure that is called when a trigger is fired can only execute SQL statements that are allowed as triggered action statements.

Other statements result in the system returning a failure message to the external stored procedure. An external stored procedure that receives such a message has an opportunity to post the error and close any external files or disconnect any connections it established. The only remaining course of action is for it to return.

IF the external stored procedure receives a failure message and … THEN the triggering request is terminated and …
returns with its own error by setting the SQLSTATE to its own exception code the original fail condition will not be known to the caller of the external stored procedure.
returns with no error by setting SQLSTATE to '00000' the system returns the original failure to the caller.
attempts to submit another request the system generates a 7836 error: The XSP db.name submitted a request subsequent to receiving a trigger fail message.

For more details and a list of SQL statements that are allowed as triggered action statements, see the information about CREATE TRIGGER in Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.