Solved

Oracle Unique Index without matching Primary Key or Unique Key

Posted on 2011-03-25
6
631 Views
Last Modified: 2012-05-11
When a Oracle Unique Index is defined for a table, and no Primary Key or Unique Key is defined for the table (Or a Primary Key or Unique Key is defined that has less columns than the Unique Index) Is the unique index enforced for table updates and inserts for Oracle 11 and/or previous releases?
0
Comment
Question by:pendlewe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 63 total points
ID: 35218667
Not sure about the rest of the question but...

>>Is the unique index enforced for table updates and inserts for Oracle 11 and/or previous releases?

Yes.  That's sort of by definition of an RDBMS.


0
 

Author Comment

by:pendlewe
ID: 35218854
In older Oracle, a Unique Index was created (*I think*) whenever a Primary Key was created. I think this is no longer true. My objective is to automate insert, update, and deletes in ~1000 oracle tables based on uniqueness, using dynamic SQL.

Thanks,
Bill
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 62 total points
ID: 35219131
if an index (unique or non-unique) is already available that Oracle thinks will be efficiently usable to enforce the PK constraint,  then it won't create a new index.  
If there is no such index in place then creating the constraint will create the index.  This is still true all the way up to 11gR2.




0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 62 total points
ID: 35219139
so, obvious question is: Why would an index NOT be usable?

If it's for different columns than the PK enforces
or if it has insufficient columns

0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 63 total points
ID: 35219172
>>In older Oracle, a Unique Index was created (*I think*) whenever a Primary Key was created.

I forget a lot about the very early versions of Oracle but there is a difference between a PK and Unique index.

A PK will NOT allow a null where a Unique index will.
0
 

Author Closing Comment

by:pendlewe
ID: 35232751
Thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question