16.20 - Consuming Result Sets Created by Calling a Stored Procedure - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
April 2020
Content Type
Programming Reference
Publication ID
English (United States)

An external stored procedure that uses CLIv2 to directly execute SQL can call a stored procedure that creates up to 15 dynamic result sets.

To indicate that the external stored procedure is willing to consume result sets created by a stored procedure, the SQL request that contains the CALL statement must set the Dynamic Result Sets Allowed option in the DBCAREA to 'Y'.

Here is a code excerpt for a request that calls a stored procedure called sp1:

dbcarea.change_opts                 = 'Y';
dbcarea.dynamic_result_sets_allowed = 'Y'; 
dbcarea.req_ptr                     = "CALL sp1('SEL * FROM t1');";

For a complete code example, see Using CLIv2 to Consume Dynamic Result Sets. You can use the code example to see the types of parcels in a response that Teradata Database returns to the caller of a stored procedure that creates result sets.