I don't understand the reference "2" in the following message. There is
only a primary key constraint on the named table. It is generated by
default and Im not inserting a value for it.
SQL0803N One or more values in the INSERT statement, UPDATE statement,
or foreign key update caused by a DELETE statement are not valid because
the primary key, unique constraint or unique index identified by "2"
constrains table "IS3.ENTITIES_PUB" from having duplicate rows for those
columns. SQLSTATE=23505
The DDL for the offending table:
CREATE TABLE IS3.ENTITIES_PUB
(ENTITY_ID INTEGER NOT NULL GENERATED BY DEFAULT
AS IDENTITY (START WITH 20, INCREMENT BY 1, CACHE 20, MINVALUE 20,
MAXVALUE 2147483647, NO CYCLE, NO ORDER),
NAMEX VARCHAR(50) NOT NULL,
CITY VARCHAR(30),
STATE VARCHAR(30),
COUNTRY VARCHAR(30) DEFAULT 'United States'
)
DATA CAPTURE NONE
IN USERSPACE1;
ALTER TABLE IS3.ENTITIES_PUB
LOCKSIZE ROW
APPEND OFF
NOT VOLATILE;
ALTER TABLE IS3.ENTITIES_PUB
ADD CONSTRAINT PRIMARY PRIMARY KEY
(ENTITY_ID
);
The failing statement:
merge into is3.entities_pub t1
using an_pub_names_in t2
on t2.ranch=t1.namex
and t2.city=t1.city
and t2.state=t1.state
and t2.country=t1.country
when not matched and t2.entity_id is null
then insert (namex,city,state,country)
values(ranch,city,state,country); 2 7611
Robert Stearns wrote: I don't understand the reference "2" in the following message. There is only a primary key constraint on the named table. It is generated by default and Im not inserting a value for it.
SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "2" constrains table "IS3.ENTITIES_PUB" from having duplicate rows for those columns. SQLSTATE=23505
The DDL for the offending table:
CREATE TABLE IS3.ENTITIES_PUB (ENTITY_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 20, INCREMENT BY 1, CACHE 20, MINVALUE 20, MAXVALUE 2147483647, NO CYCLE, NO ORDER), NAMEX VARCHAR(50) NOT NULL, CITY VARCHAR(30), STATE VARCHAR(30), COUNTRY VARCHAR(30) DEFAULT 'United States' ) DATA CAPTURE NONE IN USERSPACE1;
ALTER TABLE IS3.ENTITIES_PUB LOCKSIZE ROW APPEND OFF NOT VOLATILE;
ALTER TABLE IS3.ENTITIES_PUB ADD CONSTRAINT PRIMARY PRIMARY KEY (ENTITY_ID );
The failing statement:
merge into is3.entities_pub t1 using an_pub_names_in t2 on t2.ranch=t1.namex and t2.city=t1.city and t2.state=t1.state and t2.country=t1.country when not matched and t2.entity_id is null then insert (namex,city,state,country) values(ranch,city,state,country);
I realize it is bad netiquette to reply to one's own message, but I have
further information which gets me no closer to the solution of the
problem and, in fact confuses me (easily done) even more. I discovered
(via db2 ? sql0803n, et seq) that the problem was the following index:
CREATE UNIQUE INDEX IS3.E_P_N_C_S_C
ON IS3.ENTITIES_PUB
(NAMEX ASC,
CITY ASC,
STATE ASC,
COUNTRY ASC
)
PCTFREE 10
DISALLOW REVERSE SCANS;
My insert is predicated on at least one of these not matching as I
(mis)understand the merge statement given above. Just in case I didn't
understand the precedence or some foolishness like that, I tried various
combinations of parentheses in the 'when' clause; bad move, the error
messages got STRANGE at that point.
Robert Stearns wrote: Robert Stearns wrote:
I don't understand the reference "2" in the following message. There is only a primary key constraint on the named table. It is generated by default and Im not inserting a value for it.
SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "2" constrains table "IS3.ENTITIES_PUB" from having duplicate rows for those columns. SQLSTATE=23505
The DDL for the offending table:
CREATE TABLE IS3.ENTITIES_PUB (ENTITY_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 20, INCREMENT BY 1, CACHE 20, MINVALUE 20, MAXVALUE 2147483647, NO CYCLE, NO ORDER), NAMEX VARCHAR(50) NOT NULL, CITY VARCHAR(30), STATE VARCHAR(30), COUNTRY VARCHAR(30) DEFAULT 'United States' ) DATA CAPTURE NONE IN USERSPACE1;
ALTER TABLE IS3.ENTITIES_PUB LOCKSIZE ROW APPEND OFF NOT VOLATILE;
ALTER TABLE IS3.ENTITIES_PUB ADD CONSTRAINT PRIMARY PRIMARY KEY (ENTITY_ID );
The failing statement:
merge into is3.entities_pub t1 using an_pub_names_in t2 on t2.ranch=t1.namex and t2.city=t1.city and t2.state=t1.state and t2.country=t1.country when not matched and t2.entity_id is null then insert (namex,city,state,country) values(ranch,city,state,country); I realize it is bad netiquette to reply to one's own message, but I have further information which gets me no closer to the solution of the problem and, in fact confuses me (easily done) even more. I discovered (via db2 ? sql0803n, et seq) that the problem was the following index:
CREATE UNIQUE INDEX IS3.E_P_N_C_S_C ON IS3.ENTITIES_PUB (NAMEX ASC, CITY ASC, STATE ASC, COUNTRY ASC ) PCTFREE 10 DISALLOW REVERSE SCANS;
My insert is predicated on at least one of these not matching as I (mis)understand the merge statement given above. Just in case I didn't understand the precedence or some foolishness like that, I tried various combinations of parentheses in the 'when' clause; bad move, the error messages got STRANGE at that point.
More bad netiquette:
I found the problem by luck, not skill. It turns out that two rows of t2
satisfied the not matched condition at the same time, so an attempted
double update caused the problem. I found the data error accidentally,
looking at another incidental error. Maybe better diagnostics are in order. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hong |
last post by:
Hi,
I am trying to create a switch but I do not know why I am geting an
error message, can someone tell me what is wrong,
Error Message;
Warning: Unexpected character in input: '\'...
|
by: SoSaucily |
last post by:
I am getting the 'partially uploaded file' error with uploads over
about 4k-5k. $_FILE = 3. Rackin my brain on
this one, any help appreciated.
Php.ini
- upload_max_filesize=2M
-...
|
by: N. Graves |
last post by:
Hello,
I don't understand this error message." Error accessing File. Network
Connection may have been lost." I'm not using any network connection
for the database. In the VBA editor is goes...
|
by: Harry |
last post by:
OS: Winxp sp2
Visual Studio 2005 Beta 1
Added Files:
dotnetfx
sdkFramework1.1
ErrrorMessages:
Warning 1 The referenced component 'OpenNETCF' could not be found.
Warning 2 Couldn't...
|
by: TJS |
last post by:
how to resolve this ?
error msg:
=================
"System.Data.SqlClient.SqlException: Distributed transaction completed.
Either enlist this session in a new transaction or the NULL...
|
by: Rafael Tejera |
last post by:
I'm receiving this error message.
An unhandled exception of type 'System.Security.SecurityException' occurred
in system.data.dll
Additional information: Request for the permission of type...
|
by: bananna77 |
last post by:
In Access'97, I am currently trying to run a Select query, which I
normally run every week, without problem, until now.
I am currently getting the following error message;
The Microsoft Jet...
|
by: teddarr |
last post by:
I have an assignment I've been working on for a few days now. I need some help with the last detail.
The program is supposed to create 5 objects with varying floating-point parameter lists. The...
|
by: phiefer3 |
last post by:
Ok, First of all, I'm using Microsoft Visual Studio 2005, and I've been getting this problem when making c++ projects starting from an empty project. I haven't tried other project types yet, so I...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: 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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |