Data Type for INOUT Constant Arguments - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantageā„¢

The data type for an INOUT constant argument is governed by the data type of the value passed in, not what is defined. If the data type of the value passed in is smaller than the data type defined in the CREATE PROCEDURE or REPLACE PROCEDURE statement, and the external stored procedure returns a value larger than the maximum value of the data type for the value passed in, the system returns an overflow error.

For example, consider an external stored procedure that defines an INTEGER INOUT parameter:

   CREATE PROCEDURE inout_example( INOUT p1 INTEGER )
   LANGUAGE C
   NO SQL
   PARAMETER STYLE SQL
   EXTERNAL;

If you call the external stored procedure with a constant input value that fits into a SMALLINT, the system returns an overflow error if the output value is larger than 32767, the maximum value of a SMALLINT:

   CALL inout_example(1000);