2015-04-04 88 views
0

我試圖插入包含無值成一隻火鳥表蟒蛇變量,但它會引發錯誤(當我插入隨機值,它工作正常):插入無值到火鳥表

fdb.fbcore.DatabaseError: ('Error while executing SQL statement:\n- SQLCODE: -802\n- arithmetic exception, numeric overf 
low, or string truncation\n- string right truncation', -802, 335544321) 

python代碼如下:

import fdb 

con = fdb.connect(dsn='OFFICINE.gdb', user='SYSDBA', password='masterkey') 
cur = con.cursor() 

spec = None 

cur.execute("update ENTETEFACT set SPECIALITE = '%s' where N_FACTURE = '04139412' " %spec) 
con.commit() 
+0

這張表的DDL是什麼? – 2015-04-04 16:57:52

+0

你是什麼意思? – 2015-04-04 21:40:30

+0

創建表,或者至少是列的定義。 – 2015-04-04 22:23:23

回答

0

爲什麼你正在嘗試字符串格式化而不是傳遞參數?

cur.execute("update ENTETEFACT set SPECIALITE = %s where N_FACTURE = '04139412' ", [spec]) 
+0

反正這對我無能爲力 – 2015-04-04 16:54:47