Calling an External Stored Procedure From a Trigger - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
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.