Primary Keys

A primary key is the column or columns that contain values that uniquely identify each row in a table. A database table must have a primary key for Optim to insert, update, restore, or delete data from a database table. Optim uses primary keys that are defined to the database. However, you can also define primary keys to supplement those in the database.

A primary key is needed:

  • In any table that is visited more than once in a process, for example, a child table that has two or more parent tables referenced in the Access Definition.
  • To enable the Point and Shoot feature for a Start Table. For details, see Edit Point and Shoot List.
Note: If a primary key is not defined and is required to perform a specific task, an error message appears. Use the Primary Key Editor to create the necessary primary key.

Types of Optim Primary Keys

You can define two types of primary keys that are stored in the Optim™ Directory:

  • An Explicit primary key applies to a single table.
  • A Generic primary key applies to any tables that have the same base name, column names, and attribute specifications, but different Creator IDs.

There is no difference in function or appearance between generic and explicit primary keys. However, if a table has keys of both types, the explicit primary key is used.

Naming Conventions

The fully qualified name of a primary key is the same as the fully qualified name of the database table for which it is defined. This name consists of: dbalias.creatorid.tablename.

dbalias
Alias that identifies the database where the table resides (1 to 12 characters).
creatorid
Creator ID assigned to the table (1 to 64 characters).
tablename
Base table name (1 to 64 characters).
Note:
  • The combined total length of columns for a primary key is limited to 3584 bytes.
  • When Object Security is enabled, the second and third parts of a primary key (i.e., the creatorid and tablename) are restricted to a combined total of 64 characters.
  • When Object Security is not enabled, each of those parts may consist of up to 64 characters. See the Installation and Configuration Guide for detailed information about Object Security.

Contents

This section explains how to create and maintain explicit and generic primary keys defined to the Optim Directory, including how to:

  • Create and edit an explicit or generic primary key.
  • Create a primary key from a unique index.
  • Convert a primary key to a generic primary key.