我正在使用pyqt5和cx_Oracle将记录插入到Oracle 11g Express Edition中的表中。当我插入第一条记录(表中尚无其他记录)时,我收到IntegrityError:ORA-00001:违反了唯一约束(MCA.SYS_C007088)。 尽管有错误,数据仍会插入表中。 请有人给我一些指导。
def genPaySlip():
dataList.append(int(uiMain.lineEdit_5.text()))
dataList.append(uiMain.lineEdit.text())
dataList.append(uiMain.lineEdit_2.text())
dataList.append(uiMain.lineEdit_3.text())
dataList.append(uiMain.lineEdit_4.text())
dataList.append(uiMain.lineEdit_6.text())
dataList.append(uiMain.lineEdit_9.text())
con = cx_Oracle.connect("mca", "mca", "localhost/xe")
cur = con.cursor()
cur.execute("Insert into EmployeeDb values(:1,:2,:3,:4,:5,:6,:7)",(dataList[0:7]));
con.commit()
cur.close()
sql表
create table Employeedb(EmployeeID number(5) primary key, Name varchar2(50), address varchar2(100),
Branch varchar(10), Department varchar2(10), Designation varchar2(20), PAN varchar2(10));