Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a concatenated unique index 1

Status
Not open for further replies.

bourrelo

Programmer
Jan 19, 2005
4
CA
I'm not used to writing database scripts, so I need assistance...

I am writing some "create table" scripts in Oracle 8.1.7 and need to create a unique index grouping 2 columns. I don't want this grouped unique index to be the primary key in the table.
For example, if I have 2 columns "calendar_year" and "calendar_month"... I want the index to group them for uniqueness. How would I write this script?

Thanks in advance.
 
Hi,
Basically you specify both columns separated by a comma..
One way:
After the table is created:
Create unique index I_Index_name on Table_name(calendar_year,calendar_month).

Or, to do it as you create the table, use the same thing ( 2 ( or more) column names separated by commas) in the CONSTRAINT clause..

[profile]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top