17.10 - SQL Function Definition - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

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';