Duplicate Primary Key error

Database
Enthusiast

Duplicate Primary Key error

I have been fighting with this for weeks now. Basically I have .NET application that is using a teradata backend. I cannot for the life of me figure out why I keep getting this error, and it's random. The application itself does not specify any auto increment. I'm leaving that up to Teradata using the following create statement.

Again - this has been completely random. It can be from updating a record or creating a new record.

CREATE TABLE BCPM_DDBO.LTC_FBS
(FBS_ID INTEGER not null GENERATED BY DEFAULT AS IDENTITY
(START WITH 1
INCREMENT BY 1),
DBS_NM varchar(50),
CLM_NUM varchar(50),
DBS_DIRECTOR varchar(50),
PROD_CODE varchar(25),
ISS_STATE varchar(2),
RES_STATE varchar(2),
FBS_REV varchar(50),
DATE_SUBMIT date,
R_D_PAID date,
R_D_RLSE date,
R_D_FPAY_DUE date,
R_D_FPAY_SUB date,
Q_PMT varchar(25),
Q_ADRESS varchar(25),
Q_LIC varchar(25),
Q_COV varchar(25),
Q_ACTIVITY varchar(25),
Q_WAIVER varchar(25),
Q_CONSIST varchar(25),
Q_DUE_DT varchar(25),
Q_CALC_CORRECT varchar(25),
Q_CALC_ varchar(25),
Q_AMT_PAY varchar(50),
Q_PAY_RLSE varchar(25),
Q_PTD_CURRENT varchar(25),
Q_DATE_RET_DBS date,
Q_PMT_RSN varchar(150),
Q_ADRESS_RSN varchar(150),
Q_LIC_RSN varchar(150),
Q_COV_RSN varchar(150),
Q_ACTIVITY_RSN varchar(150),
Q_WAIVER_RSN varchar(150),
Q_CONSIST_RSN varchar(150),
Q_DUE_DT_RSN varchar(150),
Q_CALC_CORRECT_RSN varchar(150),
Q_PAY_RLSE_RSN varchar(150),
Q_PTD_CURRENT_RSN varchar(150),
Q_CALC_RSN varchar(150),

Q_PMT_RSN2 varchar(150),
Q_ADRESS_RSN2 varchar(150),
Q_LIC_RSN2 varchar(150),
Q_COV_RSN2 varchar(150),
Q_ACTIVITY_RSN2 varchar(150),
Q_WAIVER_RSN2 varchar(150),
Q_CONSIST_RSN2 varchar(150),
Q_DUE_DT_RSN2 varchar(150),
Q_CALC_CORRECT_RSN2 varchar(150),
Q_PAY_RLSE_RSN2 varchar(150),
Q_CALC_RSN2 varchar(150),
Q_OVER_UNDER varchar(150),

D_RET_DBS date,
D_RCV_COR date,
D_PAY_RLSE date,
RLSE_BY_DBS varchar(50),
IS_NEW varchar(50),
PAY_COM varchar(1500),
FILE_COM varchar(1500)

)
UNIQUE PRIMARY INDEX FBS_ID (FBS_ID);

Tags (3)
1 REPLY
Enthusiast

Re: Duplicate Primary Key error

The SQL Data Definition Language Detailed Topics manual describes this issue in detail. See page 469 in the 13.10 documentation.

You may want to consider "no cycle" in your definition of the UPI column.