python中的甲骨文桌问题
我正在尝试执行以下代码,但有错误。任何人都可以帮忙吗?
data1=[218031839]
if not data1:
print("Nothing")
else:
cur1 = con_m.cursor()**strong text**
query_3_1a='''create table tmp_account2 as '''
query_3_1c='select ban from account where ban`enter code here` in ('
query_3_1b = ''`enter code here`
ban_cnt3 = len(data1)
print("ban_count",ban_cnt3)
j=0
for i in data1:
j=j+1
if j < ban_cnt3:
query_3_1b = query_3_1b+ format(i) + ' ,'
else:
query_3_1b = query_3_1b+ format(i) + ')'
query_3_1 = query_3_1a+query_3_1c + query_3_1b
cur1.execute(query_3_1)
print("table created")
#h1=cur1.fetchall()
#print("hhhh",h1)
for tmp_account2 in cur1:
print(tmp_account2)
错误:对于Cur1中的TMP_ACCOUNT2: cx_oracle.interfaceError:不是查询
意味着该表无法使用Python中的DB连接创建,但是如果此查询在SQL Developer中执行,则可以正常工作。
。
I am trying to execute the below code but got an error. Can anyone please help.
data1=[218031839]
if not data1:
print("Nothing")
else:
cur1 = con_m.cursor()**strong text**
query_3_1a='''create table tmp_account2 as '''
query_3_1c='select ban from account where ban`enter code here` in ('
query_3_1b = ''`enter code here`
ban_cnt3 = len(data1)
print("ban_count",ban_cnt3)
j=0
for i in data1:
j=j+1
if j < ban_cnt3:
query_3_1b = query_3_1b+ format(i) + ' ,'
else:
query_3_1b = query_3_1b+ format(i) + ')'
query_3_1 = query_3_1a+query_3_1c + query_3_1b
cur1.execute(query_3_1)
print("table created")
#h1=cur1.fetchall()
#print("hhhh",h1)
for tmp_account2 in cur1:
print(tmp_account2)
Error: for tmp_account2 in cur1:
cx_Oracle.InterfaceError: not a query
Means the table is not able to create using db connection in python but if this query gets executed in SQl developer then it's working fine.
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论