Stored Procedures Dynamic Result Sets - 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

Teradata Database has the capability for a stored procedure to return one or more result sets in addition to the output parameters being returned.

A stored procedure returns a result set to the client by creating a database cursor and not closing it before returning. A cursor opened by a stored procedure is positioned where the stored procedure left it off. A result set returned from a stored procedure is presented by ODBC as an ODBC cursor just like any other result set.

Using the OutputAsResultSet option is not recommended, because it is deprecated. For details, see DSN Option to Return Output Parameters as ResultSet.

The OutputAsResultSet ODBC data source configuration option determines how stored procedure output parameters are to be delivered to the application. If set to Yes, the values of INOUT and OUT parameters are returned as a single-row result set. If set to No (default), these parameters are returned as bound ODBC parameters. If OutputAsResultSet is set to Yes and the application also expects dynamic result sets from SPs, then the single-row result set with parameter values is the first result set returned and the application should use SQLMoreResults to position to the subsequent result sets. This is standard ODBC practice when dealing with multiple result sets.