TypeError:*:'cx_Oracle.Cursor'和'float'不支持的操作数类型

时间:2018-06-05 11:35:02

标签: oracle pycharm python-3.6

我在下面的代码中遇到错误:

import cx_Oracle
conn=cx_Oracle.connect("system/root")
cur=conn.cursor()

cur.execute("INSERT INTO item VALUES('C109','FMCG','storage',50,'10 
items','50 items','hard disk')")


p1=cur.execute("SELECT itemprice FROM item WHERE itemtype='FMCG'")
query="UPDATE TABLE item SET itemprice=%d WHERE itemtype='FMCG'"
updatedprice=p1*.03+p1
#updatedprice= float

data=[updatedprice]

cur.executemany(query,data)
cur.execute("SELECT price FROM item WHERE itemtype='FMCG'")
print(cur.fetchall())

我只需要使用executemany将价格提高3%。

错误是:

Traceback (most recent call last):
File "C:/Users/Simran/PycharmProjects/Assignment2/db_a8.py", line 10, in 
<module>
updatedprice=p1*.03+p1
TypeError: unsupported operand type(s) for *: 'cx_Oracle.Cursor' and 'float'

0 个答案:

没有答案