Why a table can have only one PK ?

Just wanted to know the reason why Oracle allows only one PK per table ?
I came across a situation where my existing large PK which is on a single (ID) column needs an alteration to add a new column (No).
ID column on which PK is based is now subjected to have duplication and that is the reason why i want to add a new column. The new column composition is not going to ensure uniqueness.
So, i need to create (alter) PK on two columns now.
It seems, in order to do that, i need to drop the existing PK and create a new one. Since this is a OLTP production database, business cannot afford to drop the existing pk.
When i tried to create a separate PK on two columns, Oracle gave me below err:
ORA-02260: table can have only one primary keySo, i wanted to understand why Oracle allows only one PK / table ? and considering above err, is there any way to make required changes to my PK without altering existing PK?
(Table is a large 30 GB partition table and PK is a non partitioned global index)
I think PROBABLY i need to drop existing PK and re-create the new one. But core intention for opening this thread is to know rational behind one pk/table concept.

OraDBA02 wrote:
Just wanted to know the reason why Oracle allows only one PK per table ?
It's not exactly Oracle's fault. The ISO SQL standard requires that a "PRIMARY KEY" constraint can only be used once per table. However, a UNIQUE constraint on non-nullable columns achieves effectively the same thing as a PRIMARY KEY. You can have multiple UNIQUE constraints.
Arguably the PRIMARY KEY constraint is unnecessary and could safely be dropped from the SQL language. In principle in the relational model a "primary" key is nothing more or less than a candidate key. All keys are equal in the relational model and there is no fundamental reason to designate a primary key at all. There is certainly no reason not to have multiple keys. In the SQL world though it is a very widely observed convention to use a PRIMARY KEY constraint for each table and to use it for all foreign key references.

Similar Messages

  • Why we can have only one public class in one source file

    why we can have only one public class in one source file

    When the java compiler is run it looks for classes referenced by the classes you are directly compiling. When looking for these referenced classes it looks for source as well as class files and compiles them automatically if the coresponding class files are missing, or older than the source.
    In order to do this it must be able to work out the source file name for any given class which might be referenced from another (the rule also applies to package level access).

  • TS3276 I can have only one recipient at a time on e-mails I am sending.

    I can have only one recipient at a time on e-mails I am sending.

    Any ideas on how to fix it?

  • How i can have only one Apple ID for everything my computer and tab and iphone?

    How I can have only one Apple ID for evrything, my computer Iphone

    Thats how the majority of people use iCloud. All you need to do is sign into the same account on all of your devices.

  • Select tables which have only one row....

    Hi Guys,
    Can you tell me if there is a way to fetch all the tables in the database with only one record?
    This is to filter out only the basic data tables in our application which consist of over 30,000 tables...
    Many Thanks...
    Napster

    if your object statistics are accurate then you can use:
    select * from dba_tables where num_rows = 1;Edited by: Martin Preiss on May 2, 2013 3:00 PM

  • A project can have only one time signature, which lasts for the entire

    length of the project.
    Really...? Are we in Kindergarden ? I want to make music..
    What should I do next..?
    Is there more flexible programs out there ?
    Thanks
    bafomet

    Can I combine different parts of one project
    yes. you could drop the exported files into a new project.
    or if more ambitious, copy and paste the regions into another project. read the tute on rescuing a file, the procedure should give you all the background info you'll need:
    http://www.bulletsandbones.com/GB/Tutorials.html#allaboutrescuingfiles

  • I can select only one row in my table why?

    hi.. i have just started cold fusion. i am trying to connect
    my database. its ok. but i can see only one row? why?
    ff4.cfm =>
    <cfquery name = "myFirstSelect" datasource="calisma">
    select * from fuat1
    </cfquery>
    ff5.cfm =>
    <cfinclude template="ff4.cfm">
    <table>
    <cfoutput query="myFirstSelect">
    <tr height="20" onMouseOver="this.bgColor='#colorlist#';"
    onMouseOut="this.bgColor='#colorrow#';" bgcolor="#colorrow#">
    <td>AD</td>
    <td>SOYAD</td>
    <td>NUMBER</td>
    </tr>
    <tr height="20" onMouseOver="this.bgColor='#colorlist#';"
    onMouseOut="this.bgColor='#colorrow#';" bgcolor="#colorrow#">
    <td>#AD#</td>
    <td>#SOYAD#</td>
    <td>#NUMBER#</td>
    </tr>
    </table>
    </cfoutput>
    i can retrieve only one row. Cannot access the second row of
    table. What can I do? What can I reach the second row?
    thankx

    ok i solve this problem thanx

  • Why can we have only one public class in our program

    Why is it that we can specify only one class as public in our source code .................................................
    Once i'd put one inner class as public ...which means now i have 2 public classes ..............out of which one is the inner class...what is the use of such public class which can be accessed by only its outer class.........
    plz. help

    Once i'd put one inner class as public ...which means
    now i have 2 public classes ..............out of
    which one is the inner class...what is the use of
    such public class which can be accessed by only its
    outer class.........
    plz. helpWrong.
    Public inner class can certainly be accessed outside.
    You just have to preface it with the name of the outer class.
    A.java
    =====
    public class A {
       AA example = new AA();
       public class AA {
           public int value() { return 5; }
    }B.java
    =====
    public class B {
       public static void main(String[] args) {
          A x = new A ();
          A.AA y = x.example;
          System.out.println(y.value());
    }

  • Create a business model when we have only one source table

    Hi,
    How to create a business model when we have only one source table in Physical layer
    Regards
    Swathi

    This is very much possible and feasible. Its called as Single Table model. Good example is SA System Subject Area where we just have a single physical source. No need to create Alias in Physical. Simply use the same table twice in BMM with one Logical Table as Dummy Fact..Like say Count of Users (aggregated). Then apply normal Complex join in BMM and present in presentation layer.
    http://gerardnico.com/wiki/dat/obiee/single_table_model
    http://gerardnico.com/wiki/dat/obiee/sasystem

  • Why we have only one log writer in oracle

    Why we have only one log writer in oracle while we have more than one DB writer and archiver in oracle.

    skvaish1 wrote:
    Was this a interview question? Looks like to me..
    High DML allows multiple log writer processes as well by spawning multiple log writer processes.
    No - there is only one log writer process per instance.
    Don't confuse the function of I/O slaves with the function of the log writer.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Where can I find the original serial number? I have only one number indicating it's an upgrade when I try to reinstall LR 5 to my other computer

    Where can I find the original serial number? I have only one number indicating it's an upgrade when I try to reinstall LR 5 to my other computer

    You might be able to find the serial number for the older version of Lightroom thru your Adobe account online if you registered it when you installed it.

  • Suddenly I can open only one Firefox window at a time. I can have multiple tabs in that window, but I can suddenly no longer open another window. What happened?

    Suddenly I can open only one Firefox window at a time. I can have multiple tabs in that window, but I can suddenly no longer open another window. What happened?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Limit on the number of partitions a table can have

    Hi,
    It's been quite some time I'm thinking of a simple and the best solution to a performance issue in my application. Benefiting out of partitioning the table seems a simplest approach; it involves very minimal changes to my application code and in addition, it keeps the overall application logic 100% intact. However, at times, the number of partitions required can grow to as large as 500 thousand. I know of another application implementing as many as 50 thousand partitions for one of its tables. I'm wondering if Oracle recommends or poses any limit to a number of partitions the table can have. How does that limit, if it exists, vary if each of my table partition holds only a small amount of data; say, not more than 2 thousand records each of 1 KB size. What are the important considerations that one needs to keep in mind while creating the huge number of partitions for a table?
    Any inputs on this would be a great help.
    Thanks,
    Aniruddh
    ps: Consider Oracle releases 10g onwards.
    Edited by: Aniruddh on Dec 30, 2009 9:46 AM
    Edited by: Aniruddh on Dec 30, 2009 9:50 AM

    Aniruddh,
    >
    What are the important considerations that one needs to keep in mind while creating the huge number of partitions for a table?
    >
    I doubt if you are using partitioning for the right causes. Please explain how is your data structured and why you need to create so many partitions..?
    when creating partition, you need to consider..
    a) why you need to partition?
    b) how is your data structured
    c) how your data is indexed.
    d) What kind of queries would you firing on this table to get the data. Will they use the partition key ?
    Thanks,
    Rajesh.
    Please mark this/any other answer as helpful or answered if it is so. If not, provide additional details/feedback.
    Always try to provide create table and insert statements to help the forum members help you better.

  • VBScript does not retrieve Member details if a Distribution/Security Group have only one Member

    Hi,
    VBScript does not retrieve Member details if a Distribution/Security Group have only one Member. I have tried several Scripts even changed the coding in it, also tried few External Script by created by other Scriptor's. Any suggestion on why this is happening. 

    Perfect... Thank you. I reworked on the Script and it is showing up. One more info required. I know my script is having another bug. Can you help me getting the member list of a User Group. When i pull it retrieves all the Group info for a user
    but no "Domain Users" Group.
    Sorry for the lame humor but it was getting late.
    As for you new request.  I do not understand what you are asking. Can you post your script and any error messages you are getting.
    ¯\_(ツ)_/¯

  • I can see only one ringtone in the custom ringtone box.plz help

    i can see only one ringtone in the custom ringtone box.plz help

    Cap,
    This view, with the one photo big and the thumbnail strip across the top, is what happens when you double-click a photo with "Edit in: Main Window" set in the Preferences. There should be a button visible that says either Done or Return, to exit edit mode and return you to the library. If you still see only one photo, use the size slider in the lower right corner to reduce the photo size and get more thumbnails on the page.
    If, for some reason, you can't exit the edit mode, you may have a corrupt preference file. Quit iPhoto. Use the Finder to navigate to Macintosh HD/ Users/ (your user name)/ Library/ Preferences/ com.apple.iPhoto.plist and move that file to the Trash. Launch iPhoto, and you should be returned to the main viewing mode. You'll have to go in the Preferences and reset them to your liking.
    Regards.

Maybe you are looking for