SQL Statements in Stored Procedures | Teradata Vantage - Executing a Stored Procedure - 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™

To execute a stored procedure, use the SQL CALL statement.

The CALL statement does not initiate a transaction.

Initiating a Transaction

Execution of the first SQL statement, other than a control statement, inside the stored procedure initiates a transaction. A control statement cannot initiate a transaction.
  • In Teradata transaction mode, each statement within the stored procedure is a separate transaction. You can explicitly initiate a transaction by specifying BT (BEGIN TRANSACTION) and ET (END TRANSACTION) inside the stored procedure body.
  • In ANSI transaction mode, unless the body of the stored procedure ends with a COMMIT, the actions of the stored procedure are not committed until a COMMIT or ROLLBACK occurs in subsequent statements.

    The request number is incremented for each SQL request inside the stored procedure.

Data Type Codes

The database returns a specific set of CLIv2 data type codes to the calling application when the CALL statement is submitted.

Stored Procedure Parameters

The data type codes returned when the CALL statement is submitted include a parameter type. Stored procedure parameters can be of three types:
  • IN (input parameter)
  • INOUT (either input or output, or both)
  • OUT (output parameter)

Parameters of all data types are nullable in stored procedures.

Related Information

  • Stored procedure execution, see the description of the CALL statement in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146.
  • Data type codes possible with a CALL statement, see the information about the DataInfo parcel in Teradata® Call-Level Interface Version 2 Reference for Workstation-Attached Systems, B035-2418 or Teradata® Call-Level Interface Version 2 Reference for Mainframe-Attached Systems, B035-2417.
  • Memory considerations for INOUT parameters, see Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.
  • Executing a stored procedure from embedded SQL, see the CALL statement in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146.