Preparing an SQL Statement - 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ā„¢
Using the syntax elements defined here, the process is as follows:
  1. Declare the variable statement_string in the client application language.
  2. Define statement_string as the literal character text of the SQL statement to be executed, still in the client application language.
  3. Execute the PREPARE statement from within SQL, defining the host variable statement_string as the SQL variable statement_name.

    PREPARE compiles the source code from statement_name into executable object code.

  4. Execute the EXECUTE or EXECUTE IMMEDIATE statement for statement_name.
  5. The database software posts return codes to SQLCODE and SQLSTATE.