473,763 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Query "Key Violations" error

10 New Member
I have a linked table (to an oracle db), and I am trying to run a simple update query against it to change some data, but I am getting the following error:

"...didn't update 0 fields due to a type conversion failure, 24 records due to key violations, 0 records due to lock violations..."

The table I'm updating has 4 primary key's, and I'm trying to update the data in one of them. The data I'm updating shouldn't violate the uniqueness of the multiple primary key's.

How do I get around the "key violations" error so I can update this field?

Thanks.
May 7 '07 #1
11 12407
JConsulting
603 Recognized Expert Contributor
I have a linked table (to an oracle db), and I am trying to run a simple update query against it to change some data, but I am getting the following error:

"...didn't update 0 fields due to a type conversion failure, 24 records due to key violations, 0 records due to lock violations..."

The table I'm updating has 4 primary key's, and I'm trying to update the data in one of them. The data I'm updating shouldn't violate the uniqueness of the multiple primary key's.

How do I get around the "key violations" error so I can update this field?

Thanks.
A simple test. Open your linked table directly from the Database window. Enter just your one field (the one you're trying to update with your query) and try to move to the next record. You'll notice that it NEEDS to have data in all fields required by the key. This is the same as if you were to create an index in a native Access table. All fields in the index must be satfied before you are allowed to save the record.
I suggest that if you need to add a record, they "dummy" up the remaining fields in your insert query.
J
May 7 '07 #2
gnortenjones
10 New Member
I'm not sure I understand what your saying.

I'm not appending the table (adding records to it), I'm updating the records that are already there, so at no point I'm having null values in the other fields.

btw, when I do try to simply enter the new data in the field I'm trying to update, I get an "odbc call failed" error.
May 7 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
I have a linked table (to an oracle db), and I am trying to run a simple update query against it to change some data, but I am getting the following error:

"...didn't update 0 fields due to a type conversion failure, 24 records due to key violations, 0 records due to lock violations..."

The table I'm updating has 4 primary key's, and I'm trying to update the data in one of them. The data I'm updating shouldn't violate the uniqueness of the multiple primary key's.

How do I get around the "key violations" error so I can update this field?

Thanks.
Post the SQL of your update query. You may inadvertently be adding a null value to some of the records.

Also 4 is a very large composite primary key. Are you sure about the structure of your database.
May 7 '07 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
I'm not sure I understand what your saying.

I'm not appending the table (adding records to it), I'm updating the records that are already there, so at no point I'm having null values in the other fields.

btw, when I do try to simply enter the new data in the field I'm trying to update, I get an "odbc call failed" error.
Sorry I didn't see this before I posted. Are you sure you have update privilages on this table?
May 7 '07 #5
gnortenjones
10 New Member
Post the SQL of your update query. You may inadvertently be adding a null value to some of the records.

Also 4 is a very large composite primary key. Are you sure about the structure of your database.
Here's the SQL:

UPDATE HMEPRODUSER_AVG _ET_STATS SET HMEPRODUSER_AVG _ET_STATS.UNIT_ CATEGORY = "3A20"
WHERE (((HMEPRODUSER_ AVG_ET_STATS.CO MMUNITY)="428") AND ((HMEPRODUSER_A VG_ET_STATS.UNI T_CATEGORY)="2A 20"));

The table has 5 fields, and according to the properties section, 4 of them are primary keys. I do have update priveledges, I was able to update the 5th field which wasn't a primary key.

For the query, I"m updating the category field to "3A20" in all fields where the category field is currently "2A20" and the community field is "428".

Thanks.
May 7 '07 #6
MMcCarthy
14,534 Recognized Expert Moderator MVP
The update looks fine. However you will have to check for data validity. Try running the following query ...
Expand|Select|Wrap|Line Numbers
  1. SELECT H1.UNIT_CATEGORY, H2.UNIT_CATEGORY
  2. FROM HMEPRODUSER_AVG_ET_STATS As H1 INNER JOIN
  3. HMEPRODUSER_AVG_ET_STATS As H2
  4. ON H1.FirstPrimaryKey = H2.FirstPrimaryKey
  5. AND  H1.SecondPrimaryKey = H2.SecondPrimaryKey
  6. AND  H1.ThirdPrimaryKey = H2.ThirdPrimaryKey
  7. WHERE H1.COMMUNITY = "428"
  8. AND H1.UNIT_CATEGORY = "2A20"
  9. AND H2.UNIT_CATEGORY = "3A20"
If I've gotten the logic right it should show you if you are trying to duplicate an existing primary key. Replace First, Second and ThirdPrimaryKey with the three other keys besides UNIT_CATEGORY.

Mary
May 7 '07 #7
gnortenjones
10 New Member
The query didn't return anything. I know that the information I'm trying to update it to is unique, the only reason the "2A20" is in there in the first place is because of a typo.

The update looks fine. However you will have to check for data validity. Try running the following query ...
Expand|Select|Wrap|Line Numbers
  1. SELECT H1.UNIT_CATEGORY, H2.UNIT_CATEGORY
  2. FROM HMEPRODUSER_AVG_ET_STATS As H1 INNER JOIN
  3. HMEPRODUSER_AVG_ET_STATS As H2
  4. ON H1.FirstPrimaryKey = H2.FirstPrimaryKey
  5. AND  H1.SecondPrimaryKey = H2.SecondPrimaryKey
  6. AND  H1.ThirdPrimaryKey = H2.ThirdPrimaryKey
  7. WHERE H1.COMMUNITY = "428"
  8. AND H1.UNIT_CATEGORY = "2A20"
  9. AND H2.UNIT_CATEGORY = "3A20"
If I've gotten the logic right it should show you if you are trying to duplicate an existing primary key. Replace First, Second and ThirdPrimaryKey with the three other keys besides UNIT_CATEGORY.

Mary
May 7 '07 #8
MMcCarthy
14,534 Recognized Expert Moderator MVP
The query didn't return anything. I know that the information I'm trying to update it to is unique, the only reason the "2A20" is in there in the first place is because of a typo.
All I can think of is the problem is in oracle. Why can't you run this update directly in oracle?
May 7 '07 #9
gnortenjones
10 New Member
All I can think of is the problem is in oracle. Why can't you run this update directly in oracle?
Well, the most obvious reason is that, aside from setting up odbc linked tables, I don't know oracle. The second reason is that my company has an oracle dba who should be doing this, but never answers his e-mail.

Thanks for your help.
May 7 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
6869
by: Koen | last post by:
Hi! What is the best way to check whether a key is pressed without blocking in C++? I know I can use cin.get(c) to get a character from standard input, but this blocks. And I know _kbhit() exists in MSVC++, but that's in <conio.h> and probably not standard, is it?
14
10143
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ~Abhijit
1
2629
by: shumaker | last post by:
....please. I've found other posts that explain the Cascade options, but the Enforce relationships option still is foggy to me. As to "enforcing relationship for ... UPDATEs"(with cascade NOT checked), then I'm guessing that an update to that key field that would normally cascade will instead produce some sort of constraint violation error?
7
3537
by: Mark Carlyle via AccessMonster.com | last post by:
I have this update query that I am trying to run. I know the syntax is messed up but do not know how to correct it. Select 'UPDATE', Transactions,'Set = where = ' From "Get Daily Balances" Transactions = name of the table I want to update balance = name of the field i want to update daily balance= name of the query result that I want to move to the table
4
5860
by: Mike R | last post by:
Hi, Could someone give me a pointer to do the following: I would like to capture a keystroke from "anywhere" , i.e If the user is in Word, Excel, Myother app, desktop etc... and they press CTRL+F12 I would like to capture this, pass it to my app and process my sub/function dependant on the keystroke. Thanks for any pointers
5
1997
by: Dave Smithz | last post by:
Hi there, Been working on an evolving DB program for a while now. Suddenly I have come across a situation where I need to update a table based on a group by query. For example, I have a table called "students". I need to update a field called "status" on this table for all members that have never attended a class. Class attendance is recorded by another table (which represents the many to
2
1575
by: sbowman | last post by:
I ran the following update query in Sql Server 8.0: update _SMDBA_._CUSTOMER_ set _SMDBA_._CUSTOMER_.client = dbo.results.adid from _SMDBA_._CUSTOMER_, dbo.results where _SMDBA_._CUSTOMER_.client = dbo.results.clientid; I got the following error: Server: Msg 2627, Level 14, State 2, Line 1 Violation of UNIQUE KEY constraint 'UQ_CUSTOMER_CLIENT'. Cannot insert
2
12228
by: Reedsp | last post by:
OS: MS XP Access version: 2003 SP2 I am trying to use an update query to replace quote marks with nothing. In essence, I'm removing quote marks. I get a error message when a field is empty or has no value in it. Query: Field: Zipcode Table: tblMemberInfo Update to: Replace(,"""","")
10
6773
by: MeeMee | last post by:
Hi I have a problem appending data into an oracle table from access. I imported the new data from an excel sheet into a table in access and useed an append query to add the data into a linked oracle table. The linked table has a composit primary key (Code, Org). The table in access has new data that are not in the oracle table and the data in the PK fields are not duplicated. I also made sure that both tables have same data types. I...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.