Rules for Input and Output Arguments - ODBC Driver for Teradata

ODBC Driver for Teradata User Guide

Product
ODBC Driver for Teradata
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-07-11
dita:mapPath
smj1488824663219.ditamap
dita:ditavalPath
Audience_PDF_product_legacy_odbc_include.ditaval
dita:id
B035-2526
lifecycle
previous
Product Category
Teradata Tools and Utilities
The following rules apply to the input and output arguments submitted with the SQL CALL statement in ODBC:
  • An IN or INOUT argument must be a question mark (? is used as an input placeholder) or value expression, with the following conditions:
Conditions for IN and INOUT Arguments 
Argument Condition
A value expression Must not contain colon-preceded identifiers. It must be a constant expression.

The value of the expression is treated as the input value for the corresponding parameter in the called stored procedure.

A NULL value expression can be used to initialize the corresponding parameter to NULL.

? The value for the corresponding IN or INOUT parameter of the called procedure must be set using ODBC-specific calls prior to calling the stored procedure.
  • An OUT argument must be an OUT call placeholder or a “?” character. A placeholder can consist of a Teradata data definition and the Teradata Database-supported FORMAT, TITLE, and NAMED phrases. If the argument is a “?” character, the value for the corresponding OUT parameter of the called procedure must be set using ODBC-specific calls prior to calling the stored procedure.
  • For an INOUT or OUT argument, an output value is returned after the CALL operation. Depending on the data source setup options, output value is retrieved differently.

    If the OutputAsResultSet option is set to Y, the values of INOUT and OUT parameters can be retrieved from the bound buffers after a SQLFetch API call, or using the SQLBindCol ODBC SDK API followed by SQLFetch API call.

    If the OutputAsResultSet option is set to N, the values of INOUT and OUT parameters are updated automatically.

  • If the OutputAsResultSet option is set to N, all the parameter markers should be bound to a variable before the procedure is called, otherwise an error message will return.
    Using the OutputAsResultSet option is not recommended, because it is deprecated. For details, see DSN Option to Return Output Parameters as ResultSet.

For the other rules and details governing the CALL statement and usage of stored procedure parameters, refer to SQL Stored Procedures and Embedded SQL (B035-1148).