void function_name ( type_1 *input_parameter_1, ..., type_n *input_parameter_n, result_type *result, int *indicator_parameter_1, ..., int *indicator_parameter_n, int *indicator_result, 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 parameters, where n is the number of parameters in the CREATE 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. The maximum number of input parameters is 128. |
In |
result_type * result | the result. The result pointer points to a data area that is big enough to hold the result that the function returns, as defined by the RETURNS clause in the corresponding CREATE FUNCTION statement. |
Out |
int * indicator_parameter_n | the indicator parameters (for functions where n > 0) corresponding to the input parameters, in the same order. If the value of the indicator argument is...
|
In |
int * indicator_result | the result indicator parameter corresponding to the result. | 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 |