Example: SHOW CONSTRAINT - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

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;