skip to main content
Schema Management : Schema Objects : Foreign Keys Catalog Table: OA_FKEYS
 

Foreign Keys Catalog Table: OA_FKEYS

The OA_FKEYS table contains information about foreign keys referenced by each table and the primary keys in each table. Each row identifies one primary key in a table and an associated foreign key or a primary key. The foreign keys information is exposed through the SQLForeignKeys ODBC call. A row is considered a primary key definition if the FKTABLE_NAME column is NULL. The primary keys information is exposed through the SQLPrimaryKeys ODBC call.
If the schema request is mapped to a function call, the cursor opened when information about primary keys or foreign keys is returned must match the column sequence and types as described in the following table. the Column name is not important.
 
Table 120: Definition of Foreign Keys Catalog Table OA_FKEYS 
Column Name
Type
Len
Description
PKTABLE_QUALIFIER*
WVARCHAR
128
Name of the database in which the table falls. Can be used to distribute tables into physically different databases.
PKTABLE_OWNER*
WVARCHAR
128
The owner of the table.
SYSTEM – the table is managed by the owner of the table.
OAUSER – the table is managed by the IP.
PKTABLE_NAME*
WVARCHAR not NULL
128
Name of the table for which the primary key is being defined.
PKCOLUMN_NAME*
WVARCHAR not NULL
128
Name of the primary column.
FKTABLE_QUALIFIER*
WVARCHAR
128
Name of the database in which the table falls. Can be used to distribute tables into physically different databases. We normally use SCHEMA.
FKTABLE_OWNER*
WVARCHAR
128
The owner of the table.
SYSTEM – the table is managed by the owner of the table.
OAUSER – the table is managed by the IP.
FKTABLE_NAME*
WVARCHAR
128
Name of the table to which the primary key is pointing to. Null if this row indicates a primary key.
FKCOLUMN_NAME*
WVARCHAR
128
Name of the foreign column to which the primary key is pointing.
KEY_SEQ
SMALLINT not NULL
 
Column sequence number in the key, starting with 1. Set to 1.
UPDATE_RULE
SMALLINT
 
Set to null
DELETE_RULE
SMALLINT
 
Set to null
FK_NAME
WVARCHAR
128
Foreign key identifier. Set to null.
PK_NAME
WVARCHAR
128
Primary key identifier. Set to null.
OA_DEFERRABILITY
Smallint
14
Set to NULL. Valid values are SQL_INITIALLY_DEFERRED, SQL_INITIALLY_IMMEDIATE, and SQL_NOT_DEFERRABLE.