Syntax for Parameter Style SQL - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™
void  procedure_name ( type_1      *in_out_parameter_1,
                       ...,
                      type_n      *in_out_parameter_n,
                      int         *indicator_parameter_1,
                       ...,
                      int         *indicator_parameter_n,
                      char         sqlstate[6],
                      SQL_TEXT     procedure_name[m],
                      SQL_TEXT     specific_procedure_name[l],
                      SQL_TEXT     error_message[p] )
{
     ...
}

where:

Parameter... Specifies... Input/Output
type_n * in_out_parameter_n the input/output parameters corresponding to the IN, OUT, or INOUT arguments, where n is the number of parameters in the CREATE PROCEDURE definition. If n = 0, no input/output parameters appear. The type is one of the C types in sqltypes_td.h that corresponds to the SQL data type of the IN, OUT, or INOUT argument.

The maximum number of input/output parameters is 256.

In/Out
int * indicator_parameter_n the indicator parameters (for procedures where n > 0) corresponding to the input/output parameters, in the same order.

If the value of the indicator argument is...

  • -1, then the corresponding input/output argument is null.
  • 0, then the corresponding input/output argument is a value.

Indicator arguments that correspond to IN or INOUT arguments are initialized to the appropriate values on input. The C/C++ function must set indicator arguments to appropriate values for corresponding OUT or INOUT arguments.

In/Out
char sqlstate[6] the success, exception, or warning return. This is a pointer to a six-character C string, where the first five characters are ASCII and the last character is a C null character. The function can set sqlstate to an SQLSTATE exception or warning condition if the function detects an error.

The string is initialized to '00000', which corresponds to a success condition.

For more information on SQLSTATE values, see Returning SQLSTATE Values.

Out
SQL_TEXT procedure_name[m] the name of the function being invoked. This is a pointer to a C string. This is the same name as the name specified by CREATE PROCEDURE procedure_name.

The C/C++ function can use this name to build error messages.

The maximum value for m is 128 characters.

In
SQL_TEXT specific_procedure_name[l] the name of the external stored procedure as specified by CREATE PROCEDURE procedure_name. This is a pointer to a C string.

The C/C++ function can use this name to build error messages.

The maximum value for l is 128 characters.

In
SQL_TEXT error_message[p] the error message text. This is a pointer to a C string where the maximum value for p is 256. Out