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

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

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