17.10 - Example: SHOW CONSTRAINT - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

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

This example shows a valid case of SHOW CONSTRAINT for a row-level security constraint.

The constraint is defined using the following row-level security constraint UDF.

     CREATE FUNCTION SYSLIB.add_func (
     CURRENT_SESSION SMALLINT)
     RETURNS SMALLINT
     LANGUAGE C
     NO SQL
     PARAMETER STYLE TD_GENERAL
     EXTERNAL NAME 'CS!add_func!/home/xiaoy/test/showtab/constraint/
                    add_func.c';

The constraint is defined as follows.

     CREATE CONSTRAINT c1 SMALLINT, NOT NULL,
     VALUES (a:1),
     INSERT SYSLIB.add_func;

A SHOW CONSTRAINT request made for row-level security constraint c1 returns the DDL for its definition as follows.

     SHOW CONSTRAINT c1;
           *** Text of DDL statement returned.
           *** Total elapsed time was 1 second.
          -------------------------------------------------------------
          CREATE CONSTRAINT c1 SMALLINT, NOT NULL,
          VALUES (a:1),
          INSERT SYSLIB.add_func;