我有以下原始数据:
id = 2345
id_num = 3,6,343,32
我需要通过cx_Oracle连接在ORACLE SQL查询中将上述两个参数作为参数传递为:
query = “””
select * from mytable where pid = 2345 and id_num in (3,6,343,32)
“””
我创建一个字典,如下所示:
sparm = {}
sparm['pid'] = id
sparm['idnum'] = id_num
并尝试使用它作为:
query = “””
select * from mytable where pid = :pid and id_num in :idnum
“””
df = pd.read_sql(query, con=conct, params=sparm)
没有成功。
:pid可以工作,但:idnum不行。如果有任何建议,我们将不胜感激。
https://stackoverflow.com/questions/57399784
复制相似问题