3.2.3 Column Key Position
Specify if the column is assigned a key position so that it is included to form the primary key of the table.
Columns that form the primary key of the table should be listed first key in hierarchy (most significant key) to last key in the hierarchy (least significant key).
Rules
- The primary key of a table (which is composed of all the columns in the key concatenated in the order specified) must be UNIQUE.
- Sequence numbers must be consecutive.
- The sequence number is automatically assigned when a key column/value is added. Sequence number is updated when the order of the key is updated in the list of keys.
Platform Considerations
- IBM i: No more than one record in a table can have any given primary key. This rule is enforced by features in the operating system (DDS keyword UNIQUE) and can never be violated. Attempting to add a record to a table with the same primary key as a record already in the table will result in a "duplicate key error".
Tips & Techniques
- There is no requirement to specify a primary key when setting up a table definition, but it is strongly recommended that each table be set up with a key.
- LANSA automatically handles duplicate key errors and there is no need for user logic to handle or check for them.
- The existence of a unique primary key is important to LANSA because it uniquely identifies one and only one record in a table.
- Column key position is not related to 3.2.2 Column Sequence. However, the key columns are typically the first columns listed in the table.
Also See
3.2.2 Column Sequence