crazy
(Crazy)
November 18, 2021, 8:33pm
1
sql_str = "SELECT table_1.id, table_1.name_id FROM table_1 JOIN table_2 ON table_1.consolidate_id = table_2.id where table_1.consolidate_id = :cons_id AND table_2.name_tag = :ntag"
I am running where consolidate_id=‘1’ and name_tag=’ALEX’
ntag = 'ALEX'
cons_id = '1'
value_dict = {"cons_id": cons_id, "ntag": ntag }
result = cursor.execute(sql_str, value_dict).fetchall()
print(len(result))
Mholscher
(Menno Hölscher)
November 19, 2021, 12:54pm
2
What happens? We are not looking over your shoulder.
My guess would be that there is no record in table_2
which has id = 1
and name_tag = "ALEX"
. Or maybe even in table_1
there may be no record for consolidate_id = 1
.
Did you check?
doerwalter
(Walter Dörwald)
November 19, 2021, 1:35pm
3
This looks correct to me. So if you get a result you didn’t expect, I guess your database content is different from what you expect.
You might get a better answer in the cx_Oracle mailing list: https://sourceforge.net/projects/cx-oracle/lists/cx-oracle-users