Solved

Oracle Unique Index without matching Primary Key or Unique Key

Posted on 2011-03-25
6
620 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
  • 2
  • 2
  • 2
6 Comments
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 63 total points
Comment Utility
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
Comment Utility
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 73

Assisted Solution

by:sdstuber
sdstuber earned 62 total points
Comment Utility
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 62 total points
Comment Utility
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 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 63 total points
Comment Utility
>>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
Comment Utility
Thank you.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now