INSERT UDF Parameter List - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-03-30
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
qnu1472247494689
lifecycle
latest
Product Category
Teradata Vantageā„¢
INSERT UDFs implement the security policy for an INSERT operation. The parameter list for an INSERT UDF consists of:
  • An input parameter that takes the current session security label as the argument.
  • A result parameter that returns the current session security label if the INSERT request passed the security policy; otherwise, 0. For details about the valid return values, see Return Values for INSERT or UPDATE UDFs. The return data type must be the same as the type specified in the definition of the constraint object.
  • Indicator parameters for the input and result parameters. These are required only if the constraint object allows nulls.

Here is an example of how to declare an INSERT UDF:

/*****  C source file name: insertlevel.c  *****/
   
#define SQL_TEXT Latin_Text
#include <sqltypes_td.h>
   
void InsertLevel( short int  *sess_level,
                  short int  *new_row )
{
     ...
}

The corresponding CREATE FUNCTION statement looks like this:

CREATE FUNCTION SYSLIB.InsertLevel( current_session SMALLINT )
        RETURNS SMALLINT
        LANGUAGE C
        NO SQL
        PARAMETER STYLE TD_GENERAL
        EXTERNAL NAME 'CS!insertlevel!cctests/insertlevel.c';
where:
  • Current_session is the system-defined parameter name that identifies the security label currently set for the session.
  • The RETURNS data_type is the same as the data type specified in the definition of the constraint object.
  • PARAMETER STYLE is SQL if the constraint object allows nulls; otherwise, PARAMETER STYLE is TD_GENERAL.