Use the Constraints tab to enter constraints for a view. This tab is disabled if any of the following conditions apply:
The following describes the options available for this tab:
Displays the Constraint Name. Click on an empty cell to add a new constraint name. The Constraint Name must be unique unless it is blank. This applies from column to column, not just within a column and from In Line to Out of Line Constraints.
Displays the column alias. Click the to open the Select Columns dialog to select a column for the grid.
Select a Constraint Type from the drop-down.
Click the button to open the Constraint State dialog where you select options for the constraint state.
Note: The following describes specific conditions regarding out of line constraints and in line constraints for this tab:
Out of Line Constraints |
In Line Constraints |
A view can have multiple out of line constraints, but it cannot have two rows with a Primary Key (PK) defined. If there are multiple PK columns, they must be defined in one row. |
A view can have multiple in line constraints per column, but it cannot have two Primary Keys (PK) for the same column. The same column cannot be both a PK and a UQ constraint on an in line constraint. The valid combinations are a Foreign Key (FK) and UQ, or an FK and a PK on a column on an in line constraint. The maximum number of rows on the grid is two. |
If a PK constraint was defined in line, you cannot define a PK constraint out of line. |
If a PK was defined for a column on an out of line constraint, you cannot define it in this tab. |
A Foreign Key (FK) must reference a unique or PK column from an underlying table or view. |
The Constraint Type is a drop-down list containing Primary Key, Foreign Key, and Unique values. Check constraints and NOT NULL/NULL constraints are not allowed on views, and the On Delete RI clause is not allowed for FK constraints on views. |
An alias must be defined on all columns when a constraint is defined. If you select a column alias and type, this rule is enforced. |
When you click the button under Constraint State, the Constraint State dialog opens. If this is an FK constraint, you cannot specify RELY for the Foreign Key if the associated Primary Key is NORELY. However, you can specify NORELY for the Foreign Key if the associated Primary Key is either RELY or unspecified. Make sure you specify the Disable state at a minimum or the DDL will contain errors. You must set the OracleConstraintState_Enabled property to False if a constraint is defined, and the Disable keyword must be Forward Engineered. |
Column Alias (within the grid) is read-only and displays the aliases (not the column names) that are associated with the constraint. |
|
If multiple aliases are chosen and it is an FK column, then the aliases must be from the same table for a given constraint name or you will get an error. |
|
When you click the button under Column Alias, the Constraint Columns dialog opens where you can select an Alias from the Available Alias list. |
|
Constraint Type is a drop-down list containing Primary Key (PK), Foreign Key (FK), and Unique (UQ) values. Check constraints are not allowed on views, and the On Delete RI clause is not allowed for FK constraints on views. |
|
When you click the button under Constraint State, the Constraint State dialog opens. If this is an FK constraint, you cannot specify RELY for the Foreign Key if the associated Primary Key is NORELY. However, you can specify NORELY for the Foreign Key if the associated Primary Key is either RELY or unspecified. Deferrable, Immediate, Use Index, and Exception Table states are not valid for view constraints. Make sure you specify the Disable state at a minimum or the DDL will contain errors. You must set the OracleConstraintState_Enabled property to False if a constraint is defined, and the Disable keyword must be Forward Engineered. |
|
Copyright © 2017 erwin Inc.
All rights reserved.
|
|