void function_name ( type_1 *input_parameter_1, ..., type_n *input_parameter_n, result_type_1 *result_1, ..., result_type_r *result_r, int *indicator_parameter_1, ..., int *indicator_parameter_n, int *indicator_result_1, ..., int *indicator_result_r, char sqlstate[6], SQL_TEXT function_name[m], SQL_TEXT specific_function_name[l], SQL_TEXT error_message[p] ) { ... }
where:
Parameter … | Specifies … | Input/Output | |||
---|---|---|---|---|---|
type_n * input_parameter_n | the input arguments, where n is the number of parameters in the CREATE FUNCTION or REPLACE FUNCTION definition. If n = 0, no input parameters appear. The type is one of the C types in sqltypes_td.h that corresponds to the SQL data type of the input argument. | In | |||
result_type_r * result_r | the row result arguments, where r is determined by the corresponding CREATE FUNCTION or REPLACE FUNCTION definition. If the table function is defined with fixed result row specification, then...
If the table function is defined with dynamic result row specification, then...
The function must return at least one result argument. |
Out | |||
int * indicator_parameter_n | the indicator arguments (for functions where n > 0) corresponding to the input arguments, in the same order. If the value of the indicator argument is...
|
In | |||
int * indicator_result_r | whether the function needs to return the corresponding result arguments. If the value of the indicator argument is...
If the function returns NULL for a result argument, the function must set the corresponding indicator argument to -1. |
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 function_name[m] | the function name. This is a pointer to a C string. This is the same name as the function name specified by CREATE FUNCTION function_name. The function can use this name to build error messages. The ANSI SQL standard defines the maximum value for m as 128. Teradata Database allows a maximum of 30 characters for function names. |
In | |||
SQL_TEXT specific_function_name[l] | the specific name of the external function being invoked, when more than one function has the same name. This is a pointer to a C string. This is the same name as the specific name specified by the SPECIFIC clause of the CREATE FUNCTION statement. If the CREATE FUNCTION statement omits the SPECIFIC clause, this name is the same as the function name specified by CREATE FUNCTION function_name. The function can use this name to build error messages. The ANSI SQL standard defines the maximum value for l as 128. Teradata Database allows a maximum of 30 characters for function names. |
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 |