15.10 - Example: UDF Parameter Style SQL - Teradata Database

Teradata Database Teradata JSON

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
TeradataJSON_15_10.ditamap
dita:ditavalPath
ft:empty

This example shows an SQL definition for a UDF using parameter style SQL with a JSON parameter, and a C function that shows the corresponding parameter list.

/* Parameter Style SQL */

CREATE FUNCTION MyJSONUDF (a1 JSON(100))  
                    RETURNS VARCHAR(100)
NO SQL
PARAMETER STYLE SQL
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!MyJSONUDF!MyJSONUDF.c!F!MyJSONUDF';
/* C source file name: myJSONUDF.c */

void MyJSONUDF (
     JSON_HANDLE   *json_handle, 
     VARCHAR_LATIN  *result, 
     int            *indicator_ary,
     int            *indicator_result,
     char           sqlstate[6],
     SQL_TEXT       extname[129],
     SQL_TEXT       specific_name[129],
     SQL_TEXT       error_message[257])	
{
  /* body function */
}