Quick Search:
 
 Oracle PL/SQL: Unique Constraint Jump to:  
Category: >> Oracle PL/SQL >> Unique Constraint  

<< lastnext >>

Snippet Name: Unique Constraint

Description: A unique constraint is a single field or combination of fields that uniquely defines a record. Some of the fields can contain null values as long as the combination of values is unique.

- In Oracle, a unique constraint can not contain more than 32 columns.

- A unique constraint can be defined in either a CREATE TABLE statement or an ALTER TABLE statement.

Note that Oracle does not permit you to create both a primary key and unique constraint with the same columns.

Also see:
» Check Constraint: Create
» Primary Key Constraint
» Foreign Key Constraints
» Current_timestamp
» Deferring Constraint Checking
» Add Primary Key Constraint example
» Constraint Checks
» Add constraint example

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 07th, 2009

CREATE TABLE table_name
(column1 datatype NULL/NOT NULL,
column2 datatype NULL/NOT NULL,
...
CONSTRAINT constraint_name UNIQUE (column1, column2, . column_n)
);
 
 
-- For example:
 
ALTER TABLE ELIGIBILITY_SUMMARIES 
ADD (CONSTRAINT ESMY_ESMY2_UK UNIQUE (PLAN_IDENTIFIER,
                                      PCP_ID,
                                      SUMMARY_MONTH)
USING INDEX
PCTFREE 10
)
/
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org