Skip to content Skip to sidebar Skip to footer

Python Oracle Insert Datatype Mismatch

I am trying to insert a dictionary into an Oracle table and its failing with data mismatch error. I want to know if the syntax I am using is a correct one. In [19]:selrow Out[19]:

Solution 1:

Thank you Lucas & haraprasadj. Based on your pointers, I came up with this:

cols =', '.join(selrow[0].keys())
vals =':'+', :'.join(selrow[0].keys())
sql='INSERT INTO DIM_CUST (%s) VALUES (%s)'% (cols, vals)
cur.execute(sql, selrow[0])
db.commit()

It works! appeciate your help.

Post a Comment for "Python Oracle Insert Datatype Mismatch"