Applying row-level protection

Protect row-level data by associating the table with a security policy and inserting an IDSSECURITYLABEL-type column.

Before you begin

About this task

There are two methods for applying row-level protection:

Procedure

  1. For a new table: Use the CREATE TABLE statement with the appropriate IDSSECURITYLABEL and SECURITY POLICY clauses, as described in Informix® Guide to SQL: Syntax.
  2. For an existing table: Use the ALTER TABLE statement with the appropriate IDSSECURITYLABEL and ADD SECURITY POLICY clauses, as described in Informix® Guide to SQL: Syntax.

Example

The following example shows a statement that applies row-level protection when you create a new table (T1) by using the security policy named company and the security label named label2.
CREATE TABLE T1
   (C1 IDSSECURITYLABEL,
   C2 int,
   C3 char (10))
   SECURITY POLICY company;

The following statement provides an example of applying row-level protection on a table (T2) that already exists on the database, by using the security policy named company. The default value for C1 is label3.

ALTER TABLE T2
  ADD (C1 IDSSECURITYLABEL DEFAULT 'label3'),
  ADD SECURITY POLICY company;

What to do next