SQL Statements in Stored Procedures | VantageCloud Lake - Running a Stored Procedure - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

To run 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

  • 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 "Memory Considerations for INOUT Parameters" in General Usage Guidelines with CREATE PROCEDURE and REPLACE PROCEDURE (SQL Form).