本文介绍了如何解决ORA-00001:违反了唯一约束(TICL_NBFC.IFSC_CODE_UNIQUE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谢谢所有

thanks all

ALTER TABLE bank_master
add CONSTRAINT Ifsc_Code_unique UNIQUE (IFSC_CODE);



我的代码有效。




my this code worked .

sb.Append(" INSERT INTO BANK_MASTER ");
sb.Append(" (ID, BANK_NAME,BRANCH_NAME,IFSC_CODE,MICR_CODE,ADDRESS_ID,MAKER_ID,MAKER_DATETIME,  COMPANY_ID) ");
sb.Append(" VALUES (Bank_Master_Id_Seq.NEXTVAL, :BANK_NAME,:BRANCH_NAME,:IFSC_CODE,:MICR_CODE,:ADDRESS_ID,:MAKER_ID,  TO_DATE(:MAKERDATETIME, 'DD-MM-YYYY'), :i_COMPANY_ID) ");

s_dsnstr = o_Cls_Utility.utl_fnGetDSNStr(SessionHandle.Current.SessionCompanyCode);
OracleConnect o_Cls_OracleConnect = new OracleConnect(s_dsnstr);
o_Cls_OracleConnect.OracleCommand_PreInit(sb.ToString());
o_Cls_OracleConnect.Parameter_String("BANK_NAME", BANK_NAME);
o_Cls_OracleConnect.Parameter_String("BRANCH_NAME", BRANCH_NAME);
o_Cls_OracleConnect.Parameter_String("IFSC_CODE", IFSC_CODE);
o_Cls_OracleConnect.Parameter_String("MICR_CODE", MICR_CODE);
o_Cls_OracleConnect.Parameter_String("ADDRESS_ID", ADDRESS_ID);
o_Cls_OracleConnect.Parameter_String("MAKER_ID", MAKER_ID);
o_Cls_OracleConnect.Parameter_String("MAKERDATETIME", MAKERDATETIME);
o_Cls_OracleConnect.Parameter_Int32("i_COMPANY_ID", Company_ID);


o_Cls_OracleConnect.ExecNonQuery();
sb.Remove(0, sb.Length);



这里给出例外ORA- 00001:违反了唯一约束(TICL_NBFC.IFSC_CODE_UNIQUE)


here it gives exception ORA-00001: unique constraint (TICL_NBFC.IFSC_CODE_UNIQUE) violated

推荐答案

引用:

错误消息



ORA-00001:违反了唯一约束(constraint_name)



错误原因



您试图执行INSERT或UPDATE语句,该语句在由唯一索引限制的字段中创建了重复值。



分辨率



解决此Oracle错误的选项包括:



选项#1



删除唯一约束。



选项#2



更改约束以允许重复值。



选项#3



修改SQL以便不创建重复值。

Error Message

ORA-00001: unique constraint (constraint_name) violated

Cause of Error

You tried to execute an INSERT or UPDATE statement that has created a duplicate value in a field restricted by a unique index.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Drop the unique constraint.

Option #2

Change the constraint to allow duplicate values.

Option #3

Modify your SQL so that a duplicate value is not created.


这篇关于如何解决ORA-00001:违反了唯一约束(TICL_NBFC.IFSC_CODE_UNIQUE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 22:43