• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Do I need to create a unique index for a unique constraint ??

 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a table creation scrript I hvae

create or replace table EDITOR (
...
CONSTRAINT "EDITOR_UNIQUE" UNIQUE(NAME, COLUMN_NAME) ENABLE
..
)

I meant to make the combination of "NAME" and "COLUMN_NAME" be unique (neither of them is PK). In the DDL script I didn't add anything else. But it seems Oracle does not actually create such constraint for me as I can insert rows with such duplicated values. I don't know why. Somebody said I need to create a "index" for this constraint like

CREATE UNIQUE INDEX "EDITOR_UNIQUE" ON "EDITOR" ("NAME", "COLUMN_NAME")
/

Is it true ??

Thanks.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic