SQL错误:ORA-00001:违反了唯一约束(RO_MARGE_TABLE_PK)

时间:2016-01-29 21:35:25

标签: sql oracle sql-insert

我不知道为什么我会收到SQL错误:ORA-00001:违反了唯一约束(RO_MARGE_TABLE_PK)

我的SQL语句是:

insert into RO_MARGE_TABLE ( PROMOTION_OFFER_ID, PROMOTION_CODE,  
SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID,     
DL_SERVICE_CODE, DL_UPDATE_STAMP, SPEED, PREMIUM_TIERS, PACKAGE_TYPE,    
EFFECTIVE_DATE, EXPIRATION_DATE, PROMOTION_AMOUNT) 
select PROMOTION_OFFER_ID, 
DECODE(PROMOTION_CODE,NULL,NULL,NVL(RTRIM(PROMOTION_CODE),' ')), 
SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, 
DECODE(APPLICATION_ID,NULL,NULL,NVL(RTRIM(APPLICATION_ID),' ')), 
DECODE(DL_SERVICE_CODE,NULL,NULL,NVL(RTRIM(DL_SERVICE_CODE),' ')),  
DL_UPDATE_STAMP, DECODE(SPEED,NULL,NULL,NVL(RTRIM(SPEED),' ')), 
DECODE(PREMIUM_TIERS,NULL,NULL,NVL(RTRIM(PREMIUM_TIERS),' ')), 
DECODE(PACKAGE_TYPE,NULL,NULL,NVL(RTRIM(PACKAGE_TYPE),' ')), 
EFFECTIVE_DATE, EXPIRATION_DATE, PROMOTION_AMOUNT 
FROM SCHEMT098.MARGE_TABLE@DBLINK865;

我得到了:SQL Error: ORA-00001: unique constraint (RO_MARGE_TABLE_PK) violated

1 个答案:

答案 0 :(得分:2)

我将假设PROMOTION_OFFER_ID是此表中的主键,基于您选择插入RO_MARGE_TABLE的列。根据您的错误,我打赌您正在尝试插入表RO_MARGE_TABLE中已存在的PROMOTION_OFFER_ID。