13.3 Examples

This section presents four examples of pdconstck.

Organization of this section
(1) Integrity checking by table
(2) Integrity checking by constraint
(3) Forced setting of check pending status by table
(4) Forced release of check pending status by constraint

(1) Integrity checking by table

This example performs integrity checking on all constraints (CST1 and CST2) that have been defined for table T2. The example assumes that table T2 is in check pending status.
  • Table definitions

T1:  CREATE TABLE T1(C1 INT PRIMARY KEY)
T3:  CREATE TABLE T3(C2 INT PRIMARY KEY)
T2:  CREATE TABLE T2(C1 INT, C2 INT,
                   CONSTRAINT CST1 FOREIGN KEY (C1) REFERENCES T1,
                   CONSTRAINT CST2 FOREIGN KEY (C2) REFERENCES T3)

Overview
[Figure]
Command

 pdconstck -k check -t T2

Explanation
-k check: Executes the integrity check facility.
-t T2: Specifies the name of the table that is to be the target of integrity checking.

(2) Integrity checking by constraint

This example performs integrity checking on constraint CST2 defined for table T2. The table definitions are the same as in (1), and the example assumes that table T2 is in check pending status.
Overview
[Figure]
Command

 pdconstck -k check -c CST2

Explanation
-k check: Executes the integrity check facility.
-c CST2: Specifies the name of the constraint that is to be the target of integrity checking.

(3) Forced setting of check pending status by table

This example performs integrity checking on all constraints (CST1 and CST2) that have been defined for table T2. The example assumes that table T2 is in non-check pending status.
  • Table definitions

 T1:  CREATE TABLE T1(C1 INT PRIMARY KEY)
 T2:  CREATE TABLE T2(C1 INT, C2 INT,
                        CONSTRAINT CST1 FOREIGN KEY (C1) REFERENCES T1,
                        CONSTRAINT CST2 CHECK (c2 > 10))

Overview
[Figure]
Command

 pdconstck -k set -t T2

Explanation
-k set: Executes forced setting of check pending status.
-t T2: Specifies the name of the table that is to be forcibly placed in check pending status.

(4) Forced release of check pending status by constraint

This example forcibly releases constraint CST2 for table T2 from check pending status. The table definitions are the same as in (3), and the example assumes that constraint CST2 is in check pending status.
Overview
[Figure]
Command

 pdconstck -k release -c CST2

Explanation
-k release: Executes forced release of check pending status.
-c CST2: Specifies the name of the constraint that is to be forcibly released from check pending status.