How to insert a timestamp in Oracle?

后端 未结 10 1730
广开言路
广开言路 2020-12-23 02:34

I have an Oracle DB with a timestamp field in it. What is the correct SQL code to insert a timestamp into this field?

10条回答
  •  别那么骄傲
    2020-12-23 03:15

    For my own future reference:

    With cx_Oracle use cursor.setinputsize(...):

    mycursor = connection.cursor();
    
    mycursor.setinputsize( mytimestamp=cx_Oracle.TIMESTAMP );
    params = { 'mytimestamp': timestampVar };
    cusrsor.execute("INSERT INTO mytable (timestamp_field9 VALUES(:mytimestamp)", params);
    

    No converting in the db needed. See Oracle Documentation

提交回复
热议问题