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 created an append query that adds the records from the imported table into the linked one. The append query is done successfully on a copy of the linked table, however I keep getting the Key Violation error when I try it on the linked table. It says that access didn't add 932 (All records) record(s) to the table due to key violations. The table has lots of fields but I want to add only the fields in the query below.
Here is my query: - INSERT INTO D7ITEST_R5OBJECTS ( OBJ_OBTYPE, OBJ_OBRTYPE, OBJ_CODE, OBJ_DESC, OBJ_RSTATUS, OBJ_RECORD, OBJ_GROUP, OBJ_USER, OBJ_ORG, OBJ_LOCATION, OBJ_MRC, OBJ_COMMISS, OBJ_STATUS, OBJ_DEPEND, OBJ_PRODUCTION, OBJ_NOTUSED, OBJ_SAFETY, OBJ_STATE, OBJ_RSTATE )
-
SELECT R5OBJECTS.[OBJ OBTYPE], R5OBJECTS.[OBJ OBRTYPE], R5OBJECTS.[OBJ CODE], R5OBJECTS.[OBJ DESC], R5OBJECTS.[OBJ RSTATUS], R5OBJECTS.[OBJ RECORD], R5OBJECTS.[OBJ GROUP], R5OBJECTS.[OBJ USER], R5OBJECTS.[OBJ ORG], R5OBJECTS.[OBJ LOCATION], R5OBJECTS.[OBJ MRC], R5OBJECTS.[OBJ COMMISS], R5OBJECTS.[OBJ STATUS], R5OBJECTS.[OBJ DEPEND], R5OBJECTS.[OBJ PRODUCTION], R5OBJECTS.[OBJ NOTUSED], R5OBJECTS.[OBJ SAFETY], R5OBJECTS.[OBJ STATE], R5OBJECTS.[OBJ RSTATE]
-
FROM R5OBJECTS LEFT JOIN D7ITEST_R5OBJECTS ON (R5OBJECTS.[OBJ CODE] = D7ITEST_R5OBJECTS.OBJ_CODE) AND (R5OBJECTS.[OBJ ORG] = D7ITEST_R5OBJECTS.OBJ_ORG);
10 6724
Hello, MeeMee.
Your query is expected to return all records from [R5OBJECTS] including those already present in [D7ITEST_R5OBJECTS].
You've missed WHERE clause -
... WHERE (D7ITEST_R5OBJECTS.OBJ_CODE IS NULL) AND (D7ITEST_R5OBJECTS.OBJ_ORG IS NULL)
-
Regards,
Fish.
Hello, MeeMee.
Your query is expected to return all records from [R5OBJECTS] including those already present in [D7ITEST_R5OBJECTS].
You've missed WHERE clause -
... WHERE (D7ITEST_R5OBJECTS.OBJ_CODE IS NULL) AND (D7ITEST_R5OBJECTS.OBJ_ORG IS NULL)
-
Regards,
Fish.
I am still getting the error after adding the where clause, the records I am adding into the linked table are not there in the linked table so it is strange i am getting key violations since the combination of the PK is not there in the linked table
Do you have any other constraint (but primary key) in the table?
Or maybe triggers?
Do you have any other constraint (but primary key) in the table?
Or maybe triggers?
there are some NOT NULL fields but I made sure they have data, some default values on some columns and a unique constraint but they allow null, and some foreign keys, it is a huge table but i am adding data to some fields
Everything is ok but doesn't work either ... ;) Very common situation.
What could I suggest ...
Being on your place I would first try to fimd circumstances when record could be added to the target table - even remove one existing record and append it back to the table. As soon as a record is being appended succesfully I would analyze difference between this "good" record and a record you try to append from [R5OBJECTS] and make various sequential changes to that "good" record towards "bad" record to localize error source.
Regards,
Fish
P.S. Did you check whether the table have any triggers (particularly append trigger)?
Everything is ok but doesn't work either ... ;) Very common situation.
What could I suggest ...
Being on your place I would first try to fimd circumstances when record could be added to the target table - even remove one existing record and append it back to the table. As soon as a record is being appended succesfully I would analyze difference between this "good" record and a record you try to append from [R5OBJECTS] and make various sequential changes to that "good" record towards "bad" record to localize error source.
Regards,
Fish
P.S. Did you check whether the table have any triggers (particularly append trigger)?
Yes , I checked for triggers, it doesn't have any .. I tried adding a new record , only one, again got the same error, I'll try the method you mentioned ..
Thanks alot :)
one question, the tables has some foreign keys refrencing other tables, I am not using these fields in the append query, I don't want to assign values to them, could this be causing the problem ??
one question, the tables has some foreign keys refrencing other tables, I am not using these fields in the append query, I don't want to assign values to them, could this be causing the problem ??
Ok.
I would repeat it once more.
Being on your place I would focus my efforts on localizing error source.
For me it means determining borders of conditions where records addition works, no matter how far they are from what you want to achieve.
Maybe it is better to test first whether you could add record to ANY table - better with some simple table specially created for this. If it works then the problem is specific for your particular table, connection and general database security are not guilty.
Then I would try to add to the target table a record as "good" as possible - all fields have values, PK fields (and other unique indexes) contain unique values, FK fields contain values existing in correspondent tables etc.
And so on in a similar manner.
Regards,
Fish
Ok.
I would repeat it once more.
Being on your place I would focus my efforts on localizing error source.
For me it means determining borders of conditions where records addition works, no matter how far they are from what you want to achieve.
Maybe it is better to test first whether you could add record to ANY table - better with some simple table specially created for this. If it works then the problem is specific for your particular table, connection and general database security are not guilty.
Then I would try to add to the target table a record as "good" as possible - all fields have values, PK fields (and other unique indexes) contain unique values, FK fields contain values existing in correspondent tables etc.
And so on in a similar manner.
Regards,
Fish
I managed to add one record by filling in the empty fields and testing, I found that there was one field that needed to be given a value although it is not a mandotry field and accepts Null .. Problem solved :)
thanks alot
You are welcome, MeeMee.
Best regards,
Fish
Sign in to post your reply or Sign up for a free account.
Similar topics
by: JMCN |
last post by:
hi-
i have inherited an access 97 database that keeps track of the loans.
i have been running into referential intergrity problems when i try to
append new loans to table.
first of all is a...
|
by: Paul Wagstaff |
last post by:
Hi there
I have 2 tables: tblAccuracy & tblClearance
Users add new records to tblAccuracy using frmRegister. Under specific
conditions I need to append the current record from frmRegister into...
|
by: strauss.sean |
last post by:
To all:
Hi! I am trying to use an append queries on a table where the key
field is numeric, formatted as 00-00-000. The query collects the
information corectly, and there are no records...
|
by: Kurt |
last post by:
For some reason I cannot use an append query to append records to a
design master replication table that has the index key on a random Long
Integer. I checked all the text fields in the Master...
|
by: a_masselink |
last post by:
It doesn't append anything to the primary key (autonumber, long
integer), only to all the other fields. Even if I set all the fields to
allow zero length: yes, indexed: no and required no. All the...
|
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...
|
by: ielamrani |
last post by:
Hi,
An append query is giving me the following error:
qryPar can't append all the records in the append query
qryPar set 0 field(s) to null due to at type conversion failure, and it did not add...
|
by: Filio |
last post by:
Hi all:
My problem is a little different than the earlier append table post.
I have T1 with an autonum field as the primary key, and T2 with
identical fields as the first, but no autonum. ...
|
by: Gerhard |
last post by:
Hi
I have a combobox on a form which gets it's Row Source from a table.
I then use an Append Query to save the selected data in the combobox to a file.
Everything works fine.
The Combobox's...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |