602SQL Documentation Index  

_IV_FOREIGN_KEYS System Query

The system query _iv_foreign_keys returns a list of referential integrity relationships between tables.

The result of this query may be very complex. It is recommended to use this only inside of another query that specifies the desired constraints for the column values.

Column description

Column name Type Contents
Schema_name CHAR(31) Name of the schema that the child table belongs
Table_name CHAR(31) Name of the child table
Constrain_name CHAR(31) Name of the integrity constraint
Definition CLOB An array of values (list of columns) in the child table
For_schema_name CHAR(31) Name of the schema that the parent table belongs
For_table_name CHAR(31) Name of the parent table
For_definition CLOB A key in the parent table (if empty, this is the primary key)
Deferred SMALLINT Deferred control check on transaction end (0=not deferred, 1=deferred, NULL=not specified)
Update_rule CHAR(12) Reaction on overwriting a value in a parent table (active referential integrity)
Delete_rule CHAR(12) Reaction on deleting a record in a parent table (active referential integrity)

Example

A query searching for tables that are children to a table:

SELECT table_name FROM _iv_foreign_keys 
WHERE schema_name='APPLICATION1' AND for_table_name='DIAL'