473,568 Members | 2,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error message help

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_P UB" from having duplicate rows for those
columns. SQLSTATE=23505

The DDL for the offending table:

CREATE TABLE IS3.ENTITIES_PU B
(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_PU B
LOCKSIZE ROW
APPEND OFF
NOT VOLATILE;

ALTER TABLE IS3.ENTITIES_PU B
ADD CONSTRAINT PRIMARY PRIMARY KEY
(ENTITY_ID
);

The failing statement:

merge into is3.entities_pu b t1
using an_pub_names_in t2
on t2.ranch=t1.nam ex
and t2.city=t1.city
and t2.state=t1.sta te
and t2.country=t1.c ountry
when not matched and t2.entity_id is null
then insert (namex,city,sta te,country)
values(ranch,ci ty,state,countr y);

Nov 12 '05 #1
2 7626
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_P UB" from having duplicate rows for those
columns. SQLSTATE=23505

The DDL for the offending table:

CREATE TABLE IS3.ENTITIES_PU B
(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_PU B
LOCKSIZE ROW
APPEND OFF
NOT VOLATILE;

ALTER TABLE IS3.ENTITIES_PU B
ADD CONSTRAINT PRIMARY PRIMARY KEY
(ENTITY_ID
);

The failing statement:

merge into is3.entities_pu b t1
using an_pub_names_in t2
on t2.ranch=t1.nam ex
and t2.city=t1.city
and t2.state=t1.sta te
and t2.country=t1.c ountry
when not matched and t2.entity_id is null
then insert (namex,city,sta te,country)
values(ranch,ci ty,state,countr y);

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_PU B
(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.

Nov 12 '05 #2
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_P UB" from having
duplicate rows for those columns. SQLSTATE=23505

The DDL for the offending table:

CREATE TABLE IS3.ENTITIES_PU B
(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_PU B
LOCKSIZE ROW
APPEND OFF
NOT VOLATILE;

ALTER TABLE IS3.ENTITIES_PU B
ADD CONSTRAINT PRIMARY PRIMARY KEY
(ENTITY_ID
);

The failing statement:

merge into is3.entities_pu b t1
using an_pub_names_in t2
on t2.ranch=t1.nam ex
and t2.city=t1.city
and t2.state=t1.sta te
and t2.country=t1.c ountry
when not matched and t2.entity_id is null
then insert (namex,city,sta te,country)
values(ranch,ci ty,state,countr y);

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_PU B
(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.

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2224
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: '\' (ASCII=92) state=1 in /home/natuk/public_html/php/order-server.php on line 2
2
2022
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 - post_max_size=8M and we have the <input type="hidden" name="MAX_FILE_SIZE" value="5000000"> input tag appearing prior to <input type="file"
3
1965
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 to "Private Sub Form_DblClick(Cancel As Integer)". I have been making a bunch of changes and I'm sure I have done something to corrupt this mdb...
3
1494
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 resolve this reference. Could not locate assembly
1
1040
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 transaction." code: ===========
1
1311
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 System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. I have VS 2003...
2
1967
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 database engine stopped the process because you and another user are attempting to change the same data at the same time I'm not trying to change...
7
2126
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 class (Rectangle) is supposed to calculate the perimeter and area and tell whether the shape is a square or not. Then put this info in a table and...
6
2782
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 don't know if this is affecting them as well. Anyways, this problem is not isolated to any individual program, it seems to just happen to all of them,...
0
7693
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
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...
1
7665
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...
0
7962
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5501
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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...
0
3651
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...
1
2105
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 we have to send another system
0
933
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...

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.