Performing SQL Statements Dynamically - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
vqj1592443206677.ditamap
dita:ditavalPath
vqj1592443206677.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantageā„¢

You can execute SQL statements dynamically in either prepared or immediate form, as described in the following table.

Stored procedures only support the immediate form of dynamic SQL.
Dynamic SQL Statement Type Description
Prepared Valid statement text is prepared and preserved for the duration of the session and the statement can be executed as many times as the application requires.

There is some overhead in preparing an SQL statement, somewhat similar to the overhead required to compile and preprocess static SQL for an embedded SQL application.

Immediate Valid statement text is executed one time only.

If a statement must be executed more than one time in an application, then you must incur the overhead of preparing and performing it each time.

Related Information