Q
Problem solve Get help with specific problems with your technologies, process and projects.

ORA-00001 error when trying to add data to table

When trying to add data from one table to another I keep getting the same error message: "ORA-00001: unique constraint."

When trying to add data from one table to another I keep getting the same error message: SQL> INSERT INTO BoatBookingMain(Week, BoatName) 2 SELECT DISTINCT Week, BoatName 3 FROM jco.BoatBooking; INSERT INTO BoatBookingMain(Week, BoatName) * ERROR at line 1: ORA-00001: unique constraint (SPARE12.PK_BOATBOOKINGMAIN) violated. What am I doing wrong? I am new to all of this!
The ORA-00001 error is telling you that an integrity constraint is being violated by your action. As such, your action is not allowed. The integrity constraint in this case ensures that all values in a specific column(s) are guaranteed to be unique. The constraint that is being violated is the SPARE12.PK_BOATBOOKINGMAIN constraint. To see the column(s) affected by this constraint, you can issue the following query:
SELECT table_name,column_name
FROM all_cons_columns
WHERE constraint_name='PK_BOATBOOKINGMAIN';
In order for your INSERT statement to succeed, you must ensure that you have not inserted duplicate column values into the columns returned from the above query.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close