DCL Statements in Stored Procedures | Teradata Vantage - DCL Statements in Stored Procedures - Teradata Vantage - Analytics Database

SQL Stored Procedures and Embedded SQL

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
frc1628111662093.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
rjx1472253414573
lifecycle
latest
Product Category
Teradata Vantage™

Supported DCL Statements

You can use the following SQL DCL statements in a stored procedure.

  • GIVE
  • GRANT (all forms)
  • GRANT CONNECT THROUGH
  • GRANT LOGON
  • REVOKE (all forms)
  • REVOKE CONNECT THROUGH
  • REVOKE LOGON

Transaction Mode Impact on DCL Statements

The behavior of DCL statements specified in stored procedures at runtime depends on the transaction mode of the Teradata session in which the procedure is created.

  • A DCL statement specified within an explicit (user-defined) transaction in a stored procedure in Teradata transaction mode must be the last statement in that transaction. Otherwise, a runtime exception (SQLCODE: 3932, SQLSTATE: ‘T3932’) is raised.
  • When performing a stored procedure in ANSI transaction mode, each DCL statement specified in the procedure body must be followed by a COMMIT WORK statement. Otherwise, a runtime exception (SQLCODE: 3722, SQLSTATE: ‘T3722’) is raised.