

Defining a Database Using SQL › Defining a CALC Key
Defining a CALC Key
You create a CALC key by issuing the CREATE CALC statement and specifying a CALC key column.
Things You Can Specify
- Whether the CALC key is unique
- Name of the table associated with this CALC key
- Name of the column or columns that make up the CALC key
Considerations
- You can define only one CALC key for a table.
- The table must be empty when you define a CALC key for it.
- You must specify NOT NULL for the column(s) on which the CALC key is placed if you use the UNIQUE option.
- The table cannot be the referencing table in a clustered referential constraint.
- The table cannot have a clustered index defined on it.
Examples
In the following example, a unique CALC key is defined on the EMPLOYEE table. The CALC key consists of one column, EMP_ID.
create unique calc key on prod.employee(emp_id);
In the following example, a unique multi-column CALC key is defined on the BENEFITS table. The CALC key consists of two columns, EMP_ID and FISCAL_YEAR.
create unique calc key on test.benefits(emp_id, fiscal_year);
Copyright © 2014 CA.
All rights reserved.
 
|
|