Getting ddl of primary key constraint
Hi
I want to drop a primary key index,
I think, In order to do that I want to drop primary key constraint.
When I get the ddl of the primary key index, it is like
CREATE UNIQUE INDEX "NI"."PREM_PK" ON "NI"."PREM" ("BRANCH_ID", "PRODUCT", "COMPANY_ID","SUM_SEQNO")
I dont undertand why there are more than 1 columns.
As far as I know primary key should be in one column.
How can I get the ddl of primary key constraint? I am little bit confused
It is perfectly legal for a primary key to be defined on a combination of different columns-- this is a composite primary key. I would generally prefer to create a new column populated by a sequence and declare that column to be the primary key rather than having a 4 column composite primary key, particularly if there is any possibility that there would ever be child tables to this table. But it is perfectly legal to have a 4 column composite primary key.
Justin
Similar Messages
-
IDOC to MSsql, error in mapping(Violation of PRIMARY KEY constraint)
Hi All,
I'm working with MATMAS IDOC to MSSql. My SQL structure is of 8 tables(multiple statements) with primary key. In mapping i have used UPDATE_INSERT in action field for all the tables but still im getting "Violation of PRIMARY KEY constraint" for the last table structure. first 7 tables are single occurances but the 8th structure data is coming multple times from IDOC(E1MARMM).
my 8th table structure is :
STATEMENT8 IDOC(MAPPED)
TABLE8
ACTION UPDATE_INSERT
TABLE TABLENAME
ACCESS 0 to Unbounded MAPPED with E1MARMM
Item_CD used oneasmany +splitbyvalue with MATNR
Plant_ID used oneasmany +splitbyvalue with WERKS
EAN_CAT used oneasmany +splitbyvalue with NUMTP
EAN used oneasmany +splitbyvalue with EAN11
Numerator_For_Conversion_To_BaseUOM
Display_UOM
Denominator_for_conversion_To_baseUOM
KEY 0 to Unbounded MAPPED with E1MARMM
Item_CD used oneasmany +splitbyvalue with MATNR
Plant_ID used oneasmany +splitbyvalue with WERKS
EAN_CAT used oneasmany +splitbyvalue with NUMTP
EAN used oneasmany +splitbyvalue with EAN11
Display_UOM
in test tab its fine and fetching number of times according to MARMM segments but in END to END testing its triggering an error stating that
""Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'MM_EAN' (structure 'STATEMENT8'): com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK_MM_EAN'. Cannot insert duplicate key in object 'dbo.MM_EAN'. ""
Plz help me regarding this..Hi team,
How resolve the below error
Violation of PRIMARY KEY constraint 'PK_test'. Cannot insert duplicate key in object 'dbo.test'. The duplicate key value is (12610). (Source: MSSQLServer, Error number: 2627) ?
Thanks,
Ram
RAM
There can be two reasons
1. The insert script used is having multiple instances of the records with Key as 12610 returned from the source query. If this is the issue add a logic to include only the unique set of id values for records by avoiding duplicates. There are several approaches
for this like using ROW_NUMBER with PARTITION BY, using a join with derived table etc
2. The record with Key 12610 already exist in your destination table and your script is again trying to insert another instances of record with same key. This can be avoided by adding a NOT EXISTS condition with a subquery which will check and return only
those records which doesnt already exist in the source
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Materialized View - does not contain a primary key constraint
I am trying to create materialized view. I gone through the MV wizard creation. Added 2 columns (foo_column, foo_pk) of the table and have a simple select statement (Select foo_column from foo_dim). Also created a primary key contrainst and refencing the primary key (FOO_PK) of the dimension.
I am getting the following error:
ORA-12014: table 'FOO_DIM' does not contain a primary key constraintIt was solved. The table that I am querying has to have a primary key defined before creating a materialized view.
-
Primary key constraint firing when there's no need
Hi All,
I've got a very weird problem.
I've written a PL/SQL procedure to insert addresses into a tabel. The adresses are assigned an unique number by means of a sequence. This unique number is the primary key of the table and has to be unique.
The following thing occurs: The primary key constraint fires whenever i try to insert a record and i can't figure out why.
I use the following code
PROCEDURE mk_adr(klant NUMBER, receiver NUMBER) IS
oidtje NUMBER DEFAULT 0;
BEGIN
BEGIN
SELECT lea_adr_seq.NEXTVAL INTO oidtje
FROM dual
INSERT INTO lea_adr (
oid, object, streetname,
housenumber, housealpha, ponumber,
postcode, cityname, locationdesc,
province, kind, country_id,
relation_id, offerrec_id,
h_trans_van,
h_geldig_van,
h_gebruiker
SELECT oidtje, oidtje, streetname,
housenumber, housealpha, ponumber,
postcode, cityname, locationdesc,
province, kind, country_id,
null, receiver,
To_Date('01-01-2000'),
To_Date('01-01-2000'),
'conv'
FROM lea_adr
WHERE relation_id = klant
EXCEPTION
WHEN Others THEN
conv_algemeen.debugMessage('mk_adr :: '||SQLERRM);
END;
END;
as you can see the very first thing i'm doing is selecting a new unique number into oidtje from the sequence which provides the numbers. Then i use it to insert the record. The insert fails with the primary key constraint firing saying that oid is not filled with an unique number.
When i do "select max(oid) from lea_adr;" I get a number lower than the number the i get when doing "select lea_adr_seq.nextval from dual;"
So am i overseeing something or is something very obvious going wrong ?
PatrickWrite your procedure like the following and it will work.
PROCEDURE mk_adr(klant NUMBER, receiver NUMBER) IS
BEGIN
INSERT INTO lea_adr (
oid, object, streetname,
housenumber, housealpha, ponumber,
postcode, cityname, locationdesc,
province, kind, country_id,
relation_id, offerrec_id,
h_trans_van,
h_geldig_van,
h_gebruiker
SELECT lea_adr_seq.NEXTVAL, lea_adr_seq.NEXTVAL, streetname,
housenumber, housealpha, ponumber,
postcode, cityname, locationdesc,
province, kind, country_id,
null, receiver,
To_Date('01-01-2000'),
To_Date('01-01-2000'),
'conv'
FROM lea_adr
WHERE relation_id = klant
EXCEPTION
WHEN Others THEN
conv_algemeen.debugMessage('mk_adr :: '||SQLERRM);
END;
Using the lea_adr_seq.NEXTVAL more then once in the SAME select will return the same value for both calls.
SQL> create sequence test
2 ;
Sequence created.
SQL> select test.nextval,test.nextval from dual;
NEXTVAL NEXTVAL
1 1
SQL> -
HI,
We have done following changes to Production environment.
1. Migrated Application from 2007 to 2010
2. Done User Domain Migration user MoveSP-User commmand
3. Then we Run following command to block users from another domain.
Set-SPSite -Identity 'SiteName' -UserAccountDirectoryPath "DC=xxx,DC=xxx,DC=xxx"
After All above changes, application were working fine without a single bug. all Operation are working fine. Then suddenly from 2 days below error coming in ULS log.
This error is thrown on item.update();
Unknown SPRequest error occurred. More information: 0x80131904
System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'AllUserDataJunctions_PK'. Cannot insert duplicate key in object 'dbo.AllUserDataJunctions'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBeh...
avior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand
command, CommandBehavior behavior, SqlQueryData ...
...monitoringData, Boolean retryForDeadLock)
at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock) at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String
bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames,
Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback,
ISP2DSafeArrayWriter pUniqueFieldCallback) at Microsoft...
....SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId,
String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback,
ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback) at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration,
Boolean bPublish, Boolean bCheckOut, Boolean bCheckin,...
SqlError: 'Violation of PRIMARY KEY constraint 'AllUserDataJunctions_PK'. Cannot insert duplicate key in object 'dbo.AllUserDataJunctions'.' Source: '.Net SqlClient Data Provider' Number: 2627 State: 1 Class: 14 Procedure: 'proc_CreateItemJunctionsVersion'
LineNumber: 9 Server: 'xxxxxxxxx\xxxxx' a035fb89-0a86-4817-b531-f20a537a002a
SqlError: 'The statement has been terminated.' Source: '.Net SqlClient Data Provider' Number: 3621 State: 0 Class: 0 Procedure: 'proc_CreateItemJunctionsVersion' LineNumber: 9 Server: 'xxxxxxxx\xxxxxxx' a035fb89-0a86-4817-b531-f20a537a002a
Please help!!!
I am unable to find any solution.
Regards,
Yogesh Ghare
EDIT - Just adding some extra points that come from observation .
1. This Error comes when following scenario is true
First Attempt: User udated item in List "Issue Tracking" from Datasheet view
Second Attempt: User udate the same item in list from "Sharepoint UI or Custom aspx form".. After clickin on Save button this erro comes up.
Third Attempt: If after error user updates the same itme from UI the the data get saved
OR
Third Attempt : If after error user updates the same itme from datasheet view User get Unresolve data confilct again and again.
Above Scenario is true only for Existing items in lists. For Newly added Items this is not producible(erroe not generated).One of the ovbservation is that All the items which are having issue are migrated from 2007 to 2010Hello,
I have the exact same issue. SharePoint List which is causing this issue has got around 140 fields (All kinds of field types).
Do this happen only if there is a migration from one version to other?
This List is created using custom code - List Instance and not using Out of box SharePoint.
Please let me know if recreating the list (using OOB) or any other fix will resolve this issue.
Below is the ULS log:
Unknown SPRequest error occurred. More information: 0x80131904
System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80131904
at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion,
Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties,
Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion,
Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin,
Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'AllUserDataJunctions_PK'. Cannot insert duplicate key in object 'dbo.AllUserDataJunctions'.
The duplicate key value is (21b5edcc-6e2d-421f-ad08-5a9e275add8a, 0x, 0, 10724c04-dcbb-4f02-af40-e19a694d015c, a558cc06-6f8a-408d-a1f6-f4b712d68881, 4096, 1, 4e405c39-8677-4ba0-8901-2ca4fa273461, 0). The statement has been terminated. at
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior
runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock)
at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)
at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)
at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32&
plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish,
String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID,
String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish,
String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32&
ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)
at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents,
String filename, Boolean bPreserveItemUIVersion)
at Microsoft.SharePoint.SPListItem.Update()
at BV.PEL.BL.Common.PublishProject(SPListItem sourceItem, Boolean isFromPublish, SPWeb web, SPSite systemSite, SPFieldUserValueCollection adminGroup, String strComments)
at BV.PEL.Portal.WebParts.OneBVProjectInformation.OneBVProjectInformationUserControl.buttonApprove_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.BLANKWEBPARTPAGE_ASPX_1653093133.ProcessRequest(HttpContext context)
at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) -
Violation of PRIMARY KEY constraint in JDBC receiver
Hi Experts !
I am configuring a JDBC Receiver. I need to insert the records and if the same record is coming again i need to update the records in my database.So I have used action "UPDATE_INSERT". But now I am getting the error,
"Violation of PRIMARY KEY constraint-Cannot insert duplicate key in object " .. Pls help me out !!! It is very urgent!!
Thanks,
LaawanyaLawanya,
It seems that you are trying to update the primary key itself..
One thing is sure The error is related to data....
Do this at JDBC receiver Communication channel :
Under advanced option : use parameter "logSQLParameter" and use value "TRUE"...by this way you will be able to see the values passing through JDBC receiver .
And then check whether the same value exist in Table or not...
Feel free to ping for further clarification..
Regards, -
Violation of PRIMARY KEY constraint
Hello,
I have the following table in my oracle database :
create table FLTRPTDATA
esn VARCHAR2(10) default 'ALL' not null,
periodid NUMBER not null,
yearid NUMBER default 2007 not null,
reportid NUMBER not null,
entryid NUMBER not null,
operatorid VARCHAR2(30) default 'XXX' not null,
param1 VARCHAR2(200),
param2 VARCHAR2(200),
param3 VARCHAR2(200),
param4 VARCHAR2(200),
param5 VARCHAR2(200),
param6 VARCHAR2(200),
param7 VARCHAR2(200),
param8 VARCHAR2(200),
param9 VARCHAR2(200),
param10 VARCHAR2(200),
acid VARCHAR2(8) default 'ALL' not null
and also have a composite primary key for the table as follows :
add constraint PK_FLTRPTDATA primary key (ESN, PERIODID, YEARID, REPORTID, ENTRYID, OPERATORID, ACID)
using index
So I expect that I can only insert a new row into the table if the combination of values for ESN,PERIODID,YEARID,REPORTID,ENTRYID,OPERATORID and ACID are unique.
I am running some software that inserts new rows into the table (via an INSERT SQL statement).
When the software runs, it inserts a certain number of rows, but then stops when inserting one of the rows with a Violation of PRIMARY KEY constraint 'PK_FLTRPTDATA'. Cannot insert duplicate key in object 'fltRPTDATA' error.
This implies that the row being inserted contains values for the composite key columns that are NOT unique. However, when I look at the data it fails to insert, I can see that there are NO rows in the table for this combination of column values.
If I then try to MANUALLY insert the same row myself (via my own SQL statement in SQL Developer), the row is inserted with no error.
When I run the software, the first thing it does is delete any rows in the table that it will subsequently insert, so there cannot be any duplicate entries in the table before the inserts take place. I have run the SQL statement that does the deletion myself manually, and it does delete all of the relevant rows.
I have checked the code (I am not the author), and I cannot see anything that would cause the same INSERT to be executed twice.
I have checked the log file generated by the software, and the INSERT is only attempted once (according to the log).
I don't understand why the insert fails when I run the software, and I am wondering if anyone can shed any light on the issue? Has anyone seen this scenario before where you get a PRIMARY KEY constraint violation on a composite key, where the data being inserted IS unique?
Thanks for any help and apologies if this is in the wrong forum,
Jason.>
I don't understand why the insert fails when I run the software, and I am wondering if anyone can shed any light on the issue? Has anyone seen this scenario before where you get a PRIMARY KEY constraint violation on a composite key, where the data being inserted IS unique?
>
One way to find those records would be to create and use a dml error log table. Then those records would get logged to the log table and would not prevent the insert of the valid records.
See Loading Tables in the DBA Guide
http://docs.oracle.com/cd/E11882_01/server.112/e17120/tables004.htm#InsertDMLErrorLogging
Then you can examine the records in the log table and see why they were rejected. -
Hello everyone,
I am getting the following error while importing the CRM 2013 managed solution, Does anyone have any idea regarding this, What could be the possible cause for this ?
"Violation of PRIMARY KEY constraint 'XPKLocalizedLabel'. Cannot insert duplicate key in object 'MetadataSchema.LocalizedLabel'. The duplicate key value is (184191c0-1d6f-e411-9400-e41f13be2efc, 25a01723-9f63-4449-a3e0-046cc23a2902, 0,
Jan 1 1900 12:00AM). The statement has been terminated."
and this guids in the error message is different from organization to organization. Where it is having fix with the solution or organization ?
please help me to solve this.
Thanks in advance, VeereshHi All,
I have exported one unmanaged solution from my development CRM system and imported in to production, while importing i am getting the following error.
"Violation of PRIMARY KEY constraint 'XPKLocalizedLabel'. Cannot insert duplicate key in object 'MetadataSchema.LocalizedLabel'. The duplicate key value is (184191c0-1d6f-e411-9400-e41f13be2efc, 25a01723-9f63-4449-a3e0-046cc23a2902,
0, Jan 1 1900 12:00AM).
The statement has been terminated."
The key point i have noticed here is, recently i have updated my CRM system with server pack 1 and development organization is created after the server pack is installed and production organization is created before the server pack is installed. and
i have tried this in some other organization which is created before the server pack 1 installed it is failed there also and some organization which is created after the server pack 1 is installed it is imported successfully.
so i can see here it is not able to import solution into organization which is created before server pack 1 is installed from which is created after the server pack 1 is installed.
please help me to solve this error.
Thanks,
Veeresh
Thanks in advance, Veeresh -
Primary key constraint for index-organized tables or sorted hash cluster
We had a few tables dropped without using cascade constraints. Now when we try to recreate the table we get an error message stating that "name already used by an existing constraint". We cannot delete the constraint because it gives us an error "ORA-25188: cannot drop/disable/defer the primary key constraint for index-organized tables or sorted hash cluster" Is there some sort of way around this? What can be done to correct this problem?
What version of Oracle are you on?
And have you searched for the constraint to see what it's currently attached to?
select * from all_constraints where constraint_name = :NAME; -
ORA-12014 table does not contain a primary key constraint
Hi
I have some existing Materialised Views I am trying to redeploy through OWB as its now our standard tool.
The existing code has
CREATE MATERIALIZED VIEW .......
.REFRESH ON DEMAND WITH ROWID AS
SELECT *
FROM apps.fafg_assets
When I create in OWB you only put the select statement, there is nowhere to put the 'with rowid ' part hence I get the following error on deployment;
ORA-12014: table 'FAFG_ASSETS' does not contain a primary key constraint
I cannot put a primary key on this table though so how do I get around this in OWB? Like I say writing the MV in PL/SQL putting the 'with rowid' bit makes it work?
ThanksHi...
I believe you'll need a PK so Oracle will know how to update the MV. Is there any particular reason for you not having a PK in FAFG_ASSETS table? As an alternative, you may want to create a new column in this table and having a table trigger/sequence populating this column.
But It looks like you are using EBS, so, I don't know if you can add new columns to tables.
See if this thread can help you:
Re: ORA-12014: table 'XXX' does not contain a primary key constraint
Regards,
Marcos -
Index of a primary key constraint
Hi,
I have to remove (temporarily) a primary key constraint (of a table) to can convert its columns to unicode ones.
Found that after delete the PK (with "ALTER TABLE %s DROP CONSTRAINT %s" SQL command) sometimes remain its unique index, sometimes not.
I guess the system does not remove it, if it was created by user command (and not with PK by system).
Am I right?
Can I get this information of the property of index of PK? (to be able to decide to need delete it as a second step)
Please do not offer to check its existance after deletion of PK :-)
I had used to get index properties with "user_indexes" view.
Regards,
ImreFound that after delete the PK (with "ALTER TABLE %s DROP CONSTRAINT %s" SQL command) sometimes remain its unique index, sometimes not.You may force to always delete the index by
alter table my_table drop primary key drop index;or alternatively
alter table my_table drop primary key keep index; -
Error in dropping primary key constraint after import.
hi all,
i am getting the following probelm can some one help me
Usually if we drop the primary constarint the index created on the primary key will also be drop automatically.when i do export and import of particular schema and after the import if i drop the primary key constraint , the index created on the primary key is still existing .
i am using the oracle 10g database and export and import utility.
i am facing this problem on windows 2003 server
can some one help what was going wrong.
thank you in advance.
kalyanif you dont want the constraint and index then control it in the import itself.
eg:- imp constraints=n indexes=n
regds,
Thomas. -
Violation of PRIMARY KEY constraint 'PK_POP'
Hi
When i am creating a new interface in ODI. On saving it the following error pops up:
com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK_POP'. Cannot insert duplicate key in object 'dbo.SNP_POP'.
The error is irrespective of the datastores i use to create the interface
Any help appreciatedquestion for you , Is this a new work repository or a migrated Work repository and if migrated , does it have the same Work repository Id as that of the source ?
It looks like the new Incrementing Internal Id which ODI is trying to create is already present in Work repository and which is causing to PK constraint on SNP_POP.
Also try this , try duplicating any old interface and are you still getting the same error message? -
How add primary key constraint to already existing table with data
I want apply primary key constraint to already existing table with data
is there any command or way to doAlternatively, assuming you want to ensure uniqueness in your primary key column you can do this:
alter table <table name> add constraint <cons name> primary key (col1,col2) exceptions into <exception_table>
If the altter table statement fails this will populate the EXCEPTIONS table with the rows that contain duplicate values for (col1,col2).
You will need to run (or get a DBA to run) a script called UTLEXCPT.SQL (which will be in the $ORACLE_HOME/rdbms/admin directory) if you don't already have an EXCEPTIONS table.
Cheers, APC -
Violation of PRIMARY KEY constraint during sending NCCode to system
MES system is: (6.0.4.22)
External software is sending NCData to MES system and sometimes gets error:"Violation of PRIMARY KEY constraint 'PK__BC_JMSQU__3F9FE7012CDE6A9D'. Cannot insert duplicate key in object 'SAPEL1DB.BC_JMSQUEUE'. The duplicate key value is (36, 26015261174081363, 3500000000000000001)"
I provide client machine log with data details in file: "client device.txt"
and default trace part in file: "default_trace.txt"Hi!
You might be using NC Codes with Message Type assigned or you turned on RTW for NC. Please check if disabling these features makes any change.
Also you can play with "Enable SFC Complete JMS Message" system rule.
Regards,
Sergiy
Maybe you are looking for
-
After updating to windows 8.1 my wire less internet connection is getting disconnected intermittently .I am unable to predict the frequency or time period this is occurring.But now i am really struggling to use the internet.I have tried my laptop ven
-
Tried to Change Password, now wireless doesn't work
I would love any assistance with this. I used 192.168.1.1 (which my cimputer says is my ip address) to pull up the admin page. Went to wireless password and changed my password, clicked save. The page kept cycling like it was saving data for 30 minut
-
Tree in an viewstack always selecting Root on focusOut
So I have a tree in a viewStack and whenever the app loses focus the app selects the root node in the tree. 1. Select a leaf node in the tree 2. click off screen or show a popup 3. click the browser window or app 4. watch your app select the root nod
-
Why is the second row in the recordset not updated?
Hi, I have this problem. I have written a servlet named processPOItem. The following is the doPost Method in the processPOItem class: public class processPOItem extends HttpServlet { //attributes public String strPO; ConnectionPool connectionPool = n
-
Binding LinkedList to ADF Web Service Data Control
Hi guys, I would like to ask about how to bind a LinkedList (consumed from webservice) to ADF web service data control, in order to display it in JSF page. This LinkedList contains java beans that hold information I need. I've tried to ask google and