Oracle Error Ora-02260
MySQL MariaDB PostgreSQL SQLite MS Office Excel Access Word Web Development HTML CSS Color Picker Languages C Language More ASCII Table Linux UNIX Java Clipart Techie Humor Advertisement Oracle Basics ALIASES AND AND & OR BETWEEN COMPARISON OPERATORS DELETE DISTINCT EXISTS FROM GROUP BY HAVING IN INSERT INSERT ALL INTERSECT IS NOT NULL IS NULL JOIN LIKE MINUS NOT OR ORDER BY PIVOT REGEXP_LIKE SELECT SUBQUERY TRUNCATE UNION UNION ALL UPDATE WHERE Oracle Advanced Oracle Cursors Oracle Exception Handling Oracle Foreign Keys Oracle Loops/Conditionals Oracle Transactions Oracle Triggers String/Char Functions Numeric/Math Functions Date/Time Functions Conversion Functions Analytic Functions Advanced Functions Oracle / PLSQL: ORA-02260 Error Message Learn the cause and how to resolve the ORA-02260 error message in Oracle. Description When you encounter an ORA-02260 error, the following error message will appear: ORA-02260: table can have only one primary key Cause You tried to create a primary key for a table that already has a primary key. Resolution The option(s) to resolve this Oracle error are: Option #1 You can drop the existing primary key for the table and create a new primary key. For example, to drop the primary key named supplier_pk from the supplier table, you could execute the following command: ALTER TABLE supplier DROP CONSTRAINT supplier_pk; Then re-create your primary key. Share this page: Advertisement Back to top Home | About Us | Contact Us | Testimonials | Donate While using this site, you agree to have read and accepted our Terms of Service and Privacy Policy. We use advertisements to support this website and fund the development of new content. Copyright © 2003-2016 TechOnTheNet.com. All rights reserved.
CommunityOracle User Group CommunityTopliners CommunityOTN Speaker BureauJava CommunityError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. Please enter a title. You can not post a blank message. Please type your message and try again. More discussions in PL/SQL and SQL All PlacesDatabaseDatabase Application DevelopmentPL/SQL and SQL This discussion is archived 1 2 Previous Next 24 Replies Latest reply on Nov 16, 2015 11:31 PM by Solomon Yakobson Go to original post This content has been marked as https://www.techonthenet.com/oracle/errors/ora02260.php final. Show 24 replies 15. Re: ORA-02260: table can have only one primary key Frank Kulash Nov 16, 2015 10:23 PM (in response to Muhammad Salman Rafique) Hi, Muhammad Salman Rafique wrote: See this image .. Yes, that's an example of 1 primary key that includes 2 columns. It's not the same as 2 primary keys. Compare the code https://community.oracle.com/thread/3866645?start=15&tstart=0 above to what you originally posted to see the mistake. Like Show 0 Likes(0) Actions 16. Re: ORA-02260: table can have only one primary key Muhammad Salman Rafique Nov 16, 2015 10:23 PM (in response to Frank Kulash) I want to ask question... because it is in my exams paper that my sir give two primary key on one table is I create this or oracle allows us to create more than one primary key on one table ??? Like Show 0 Likes(0) Actions 17. Re: ORA-02260: table can have only one primary key jaramill Nov 16, 2015 10:25 PM (in response to Muhammad Salman Rafique) A primary key can be made up of more than 1 column (aka a composite key). But as others have mentioned, you cannot do it "inline" in your table creation. You need to create the table with just the column and datatype definitions (and perhaps a NOT NULL constraint).Then separately create your composite primary key in a separate statement. Like Show 0 Likes(0) Actions 18. Re: ORA-02260: table can have only one
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance https://www.experts-exchange.com/questions/26167879/How-can-I-create-a-composite-primary-key-in-Oracle.html Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > How can I create a composite primary key in Oracle Want to Advertise Here? Solved How can I create a composite primary key in oracle error Oracle Posted on 2010-05-07 Oracle Database Query Syntax 1 Verified Solution 1 Comment 1,119 Views Last Modified: 2013-12-07 I was trying to create a table with a composite primary key that composes of 2 primary keys from other tables, de-composing many-to-may relationship. Please see the Query and Error message below CREATE TABLE DriverLicence ( DriverId NUMBER(5,0) NOT NULL PRIMARY KEY, LocomotiveClassId oracle error ora-02260 NUMBER(2,0) NOT NULL PRIMARY KEY, FOREIGN KEY (DriverId) REFERENCES Driver, FOREIGN KEY (LocomotiveClassId) REFERENCES LocomotiveClass ) Error starting at line 1 in command: CREATE TABLE DriverLicence ( DriverId NUMBER(5,0) NOT NULL PRIMARY KEY, LocomotiveClassId NUMBER(2,0) NOT NULL PRIMARY KEY, FOREIGN KEY (DriverId) REFERENCES Driver, FOREIGN KEY (LocomotiveClassId) REFERENCES LocomotiveClass ) Error at Command Line:3 Column:39 Error report: SQL Error: ORA-02260: table can have only one primary key 02260. 00000 - "table can have only one primary key" *Cause: Self-evident. *Action: Remove the extra primary key. Select all Open in new window 0 Question by:czechmate1976 Facebook Twitter LinkedIn Google LVL 58 Best Solution bycyberkiwi CREATE TABLE DriverLicence ( DriverId NUMBER(5,0) NOT NULL , LocomotiveClassId NUMBER(2,0) NOT NULL , FOREIGN KEY (DriverId) REFERENCES Driver, FOREIGN KEY (LocomotiveClassId) REFERENCES LocomotiveClass, Go to Solution 1 Comment LVL 58 Overall: Level 58 Query Syntax 23 Oracle Database 10 Message Accepted Solution by:cyberkiwi2010-05-07 CREATE TABLE DriverLicence ( DriverId NUMBER(5,0) NOT NULL , LocomotiveClassId NUMBER(2,0) NOT NULL , FOREIGN KEY (DriverId) REFERENCES Driver, FOREIGN KEY (LocomotiveClassId) REFERENCES LocomotiveClass, PRIMARY KEY(DriverId, LocomotiveClassId) ) 0 Write Co