日期:2014-05-16  浏览次数:21455 次

ORA-00001: 违反唯一约束条件
操作的语句如下:
INSERT
INTO sc_jc_gjj
  (
    sc_jc_gjj.em_id,
    sc_jc_gjj.em_name,
    sc_jc_gjj.dv_id,
    sc_jc_gjj.acc_balance,
    sc_jc_gjj.amount_dv,
    sc_jc_gjj.amount_em,
    sc_jc_gjj.amount_hj,
    sc_jc_gjj.bank_name,
    sc_jc_gjj.em_gjj_no,
    sc_jc_gjj.gjj_acc,
    sc_jc_gjj.identi_code,
    sc_jc_gjj.acc_status,
    sc_jc_gjj.comments
  )
SELECT Sc_gjj_account.em_id,
  Sc_gjj_account.em_name,
  Sc_gjj_account.dv_id,
  Sc_gjj_account.acc_balance,
  Sc_gjj_account.amount_dv,
  Sc_gjj_account.amount_em,
  Sc_gjj_account.amount_hj,
  Sc_gjj_account.bank_name,
  Sc_gjj_account.em_gjj_no,
  Sc_gjj_account.gjj_acc,
  Sc_gjj_account.identi_code,
  Sc_gjj_account.acc_status,
  Sc_gjj_account.comments
FROM Sc_gjj_account


报ORA-00001: 违反唯一约束条件,sc_jc_gjj里没有数据,这是什么情况啊?
------解决方案--------------------
引用:
Quote: 引用:

sc_jc_gjj表的唯一约束是什么个情况?
Sc_gjj_account中对应的列的数据是否有重复
我要把Sc_gjj_account的数据传给sc_jc_gjj,如果sc_gjj_account对应的列的数据有重复的怎么处理呢?

两个办法:
1:删除sc_gjj_account中的重复数据;
2:修改表sc_jc_gjj的约束,使sc_gjj_account中的重复数据对于新的约束来说不重复。