DELETE UDF Parameter List - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantageā„¢
DELETE UDFs implement the security policy for a DELETE operation. The parameter list for a DELETE UDF consists of:
  • An input parameter that takes the security label from the target row as the argument.
  • A result parameter that returns 'T' if the DELETE request passed the security policy or 'F' if the request failed the security policy. For details about the valid return values, see Return Values for SELECT or DELETE UDFs.
  • 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 a DELETE UDF:

/*****  C source file name: deletelevel.c  *****/
   
#define SQL_TEXT Latin_Text
#include <sqltypes_td.h>
   
void DeleteLevel( short int  *curr_row,
                  char       *result )
{
     ...
}

The corresponding CREATE FUNCTION statement looks like this:

CREATE FUNCTION SYSLIB.DeleteLevel( input_row SMALLINT )
        RETURNS CHAR
        LANGUAGE C
        NO SQL
        PARAMETER STYLE TD_GENERAL
        EXTERNAL NAME 'CS!deletelevel!cctests/deletelevel.c';
where:
  • input_row is the system-defined parameter name that identifies the security label from the target row.
  • PARAMETER STYLE is SQL if the constraint object allows nulls; otherwise, PARAMETER STYLE is TD_GENERAL.