Forum Stats

  • 3,769,895 Users
  • 2,253,029 Discussions


How do we insert dates using executemany in Python+cx_Oracle ?

edited Dec 5, 2017 6:29AM in Python


I am using Oracle 11g and Python 2.7 to insert data into my tables.

I have a list of dictionaries - example [ {"Date": "12/12/2012" , "CheckStatement" : "Yes"} , {"Date": "13/12/2012" , "CheckStatement" : "Yes"}]

I make a list of lists out it- example [["11/11/2017 5:06", "Yes"], ["11/11/2017 5:06", "Yes"]]

My DB table looks like -

CheckStatement (String)
11/11/2017 5:06Yes
11/11/2017 5:06No
11/11/2017 5:06Yes

How do I execute the executemany() function so that my dates are filled with it?

Currently i get this error - ORA-01843: not a valid month


  • SeánMacGC
    SeánMacGC Member Posts: 2,914 Gold Trophy
    edited Dec 5, 2017 6:29AM

    Hello, could you try with the ANSI date format, ie, 'YYYY-MM-DD' , so see if that avoids the error?

    And, additionally, the ANSI date timestamp format would be: 'YYYY-MM-DD HH24:MI:SS.FFFFFF'.

This discussion has been closed.