Example: Specifying a RETURNS or RETURNS STYLE Clause for an OUT Parameter Return Type - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

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);