B
Beppe
Hi all,
I don't know if it is the correct place to set this question, however,
I'm using cx_Oracle to query an Oracle database.
I've a problem to use the IN clause with a variable.
My statement is
sql = "SELECT field1,field2,field3
FROM my_table
WHERE field_3 IN arg_1)"
where arg_1 is retrive by a dictionary
that is build so
my_dict = {'location':"X",
'oracle_user':'user',
'oracle_password':'pass',
'dsn':'dsn',
'mailto':'(e-mail address removed)',
'codes':"CNI,CNP"}
args = (dict['codes'],)
con = cx_Oracle.connect(my_dict["oracle_user"],
my_dict["oracle_password"],
my_dict["dsn"])
cur = con.cursor()
cur.execute(sql,args)
rs = cur.fetchall()
but it doesn't work in the sense that doesn't return anything
If i use the statment without variable
SELECT field1,field2,field3
FROM my_table
WHERE field_3 IN ('CNI','CNP')
the query works
what is wrong?
suggestions?
regards
beppe
I don't know if it is the correct place to set this question, however,
I'm using cx_Oracle to query an Oracle database.
I've a problem to use the IN clause with a variable.
My statement is
sql = "SELECT field1,field2,field3
FROM my_table
WHERE field_3 IN arg_1)"
where arg_1 is retrive by a dictionary
that is build so
my_dict = {'location':"X",
'oracle_user':'user',
'oracle_password':'pass',
'dsn':'dsn',
'mailto':'(e-mail address removed)',
'codes':"CNI,CNP"}
args = (dict['codes'],)
con = cx_Oracle.connect(my_dict["oracle_user"],
my_dict["oracle_password"],
my_dict["dsn"])
cur = con.cursor()
cur.execute(sql,args)
rs = cur.fetchall()
but it doesn't work in the sense that doesn't return anything
If i use the statment without variable
SELECT field1,field2,field3
FROM my_table
WHERE field_3 IN ('CNI','CNP')
the query works
what is wrong?
suggestions?
regards
beppe