SPDO Procedure

CONSTRAINT ADD Statement

Adds a table WHERE constraint to a table.

Requirements: You must have Control permission to add a WHERE constraint on a table.
You must set the context for the request with the SET ACLUSER statement.

Syntax

CONSTRAINT ADD table-name; where where-clause-expression;

Arguments

table-name

specifies the name of the table on which to apply the table WHERE constraint.

where-clause-expression

specifies a WHERE clause. A table constraint WHERE clause can be any WHERE clause that the server can parse and interpret. The WHERE clause can use any function that SPD Server supports. Generally, the WHERE clause uses symbolic substitution to create row-level security that is based on the values for user ID, group, or special privilege.

Details

Row-level security is created by defining WHERE constraints on tables that specify symbolic substitutions. The symbolic substitutions filter table rows based on the values for user ID, group ID, or special privilege. For information to create the WHERE clauses, see Defining WHERE Constraints on Tables. For information about symbolic substitution, see Symbolic Substitution.
Before applying a WHERE constraint to a table, note that the SPD Server SQL extensions COPY TABLE and UPDATE TABLE do not function on a table that has a table constraint WHERE clause. If you try to use COPY TABLE or UPDATE TABLE, the destination table contains rows that were filtered by the WHERE constraints on the source table. The destination table does not inherit the WHERE constraints of the source table. To retain the WHERE clause, you must use a different method to copy the table, such as PROC COPY or SQL CREATE TABLE as SELECT. Table owners should grant Update access only to users who can modify any row of the table, delete any row of the table, or append new rows to the table.
Table WHERE constraints do not affect normal table ACL settings, such as Read, Write, and Column access.

Example

For an example of how the CONSTRAINT ADD statement is used, see Example Table Constraint WHERE Clauses.
Last updated: February 3, 2017