Solved

Oracle Unique Index without matching Primary Key or Unique Key

Posted on 2011-03-25
6
628 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle SQL Select unique values from two columns 4 81
Procedure syntax 5 50
oracle forms question 22 48
oracle sqlplus query delimiter 8 39
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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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 video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

733 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