Example: Specifying a RETURNS or RETURNS STYLE Clause for an OUT Parameter Return Type - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantageā„¢

The first example shows how to use a RETURNS clause when invoking an external stored procedure. The RETURNS clause explicitly specifies a return type of INTEGER for the result_1 OUT parameter.

For this example to be valid, the OUT parameter result_1 must be defined with a data type of TD_ANYTYPE in xsp_1.

     CALL xsp_1(10.25, result_1 RETURNS INTEGER);

The second example shows how to specify a RETURNS STYLE clause when invoking an external stored procedure.

This example refers to table t1, which has the following definition.

     CREATE TABLE t1 (
       int_col     INTEGER,
       varchar_col VARCHAR(40) CHARACTER SET UNICODE);

The RETURNS STYLE clause implicitly specifies a return type of VARCHAR(40) CHARACTER SET UNICODE for the result_1 OUT parameter of xsp_2 because that is the data type for column varchar_col in table t1.

For this example to be valid, the OUT parameter result_1 must be defined with a data type of TD_ANYTYPE in xsp_2.

     CALL xsp_2(10, 'abc', result_1 RETURNS STYLE t1.varchar_col);