SQL Function Definition - 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
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantage™

The function to insert a row takes the session level value as input and returns the level to be assigned to the new row.

CREATE FUNCTION SYSLIB.InsertLevel( current_session SMALLINT )
   RETURNS SMALLINT
   LANGUAGE C
   NO SQL
   PARAMETER STYLE TD_GENERAL
   EXTERNAL NAME 'CS!insertlevel!udfsrc/insertlevel.c';

The function to update a row takes the session level value and the target row level value as input. It returns the level to be assigned to the updated row.

CREATE FUNCTION SYSLIB.UpdateLevel( current_session SMALLINT,
                                    input_row       SMALLINT )
   RETURNS SMALLINT
   LANGUAGE C
   NO SQL
   PARAMETER STYLE TD_GENERAL
   EXTERNAL NAME 'CS!updatelevel!udfsrc/updatelevel.c';

The function to delete a row takes the target row level value as input and returns 'Y' to indicate that the DELETE request is allowed or 'N' to indicate that the request is denied.

CREATE FUNCTION SYSLIB.DeleteLevel( input_row SMALLINT )
   RETURNS CHAR
   LANGUAGE C
   NO SQL
   PARAMETER STYLE TD_GENERAL
   EXTERNAL NAME 'CS!deletelevel!udfsrc/deletelevel.c';

The function to select a row takes the session level value and the target row level value as input. It returns 'Y' to indicate that the SELECT request is allowed or 'N' to indicate that the request is denied.

CREATE FUNCTION SYSLIB.ReadLevel( current_session SMALLINT,
                                  input_row       SMALLINT )
   RETURNS CHAR
   LANGUAGE C
   NO SQL
   PARAMETER STYLE TD_GENERAL
   EXTERNAL NAME 'CS!readlevel!udfsrc/readlevel.c';

The function to insert a row takes the session category value as input and returns the category to be assigned to the new row.

CREATE FUNCTION SYSLIB.InsertCategory( current_session BYTE(8) )
   RETURNS BYTE(8)
   LANGUAGE C
   NO SQL
   PARAMETER STYLE SQL
   EXTERNAL NAME 'CS!insertcategory!udfsrc/insertcategory.c';

The function to update a row takes the session category value and the target row category value as input. It returns the category to be assigned to the updated row.

CREATE FUNCTION SYSLIB.UpdateCategory( current_session BYTE(8),
                                       input_row       BYTE(8) )
   RETURNS BYTE(8)
   LANGUAGE C
   NO SQL
   PARAMETER STYLE SQL
   EXTERNAL NAME 'CS!updatecategory!udfsrc/updatecategory.c';

The function to delete a row takes the target row category value as input and returns 'Y' to indicate that the DELETE request is allowed or 'N' to indicate that the request is denied.

CREATE FUNCTION SYSLIB.DeleteCategory( input_row BYTE(8) )
   RETURNS CHAR
   LANGUAGE C
   NO SQL
   PARAMETER STYLE SQL
   EXTERNAL NAME 'CS!deletecategory!udfsrc/deletecategory.c';

The function to select a row takes the session category value and the target row category value as input. It returns 'Y' to indicate that the SELECT request is allowed or 'N' to indicate that the request is denied.

CREATE FUNCTION SYSLIB.ReadCategory( current_session BYTE(8),
                                     input_row       BYTE(8) )
   RETURNS CHAR
   LANGUAGE C
   NO SQL
   PARAMETER STYLE SQL
   EXTERNAL NAME 'CS!readcategory!udfsrc/readcategory.c';