Note that there are some explanatory texts on larger screens.

plurals
  1. POcx_Oracle 'ORA-01843: not a valid month' with unicode parameter
    primarykey
    data
    text
    <p>I have the following: (using ipython)</p> <pre><code>In [30]: con = cx_Oracle.connect('refill_test02/******@MYDB') In [31]: cur = con.cursor() In [32]: cur.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS' NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'") In [33]: cur.execute("select to_date(:0), to_timestamp(:1) from dual", ['2013-03-12', '2013-03-12 08:22:31.332144']) Out[33]: &lt;__builtin__.OracleCursor on &lt;cx_Oracle.Connection to refill_test02@MYDB&gt;&gt; In [34]: cur.fetchall() Out[34]: [(datetime.datetime(2013, 3, 12, 0, 0), datetime.datetime(2013, 3, 12, 8, 22, 31, 332144))] In [35]: cur.execute("select to_date(:0), to_timestamp(:1) from dual", [u'2013-03-12', '2013-03-12 08:22:31.332144']) Out[35]: &lt;__builtin__.OracleCursor on &lt;cx_Oracle.Connection to refill_test02@MYDB&gt;&gt; In [36]: cur.fetchall() Out[36]: [(datetime.datetime(2013, 3, 12, 0, 0), datetime.datetime(2013, 3, 12, 8, 22, 31, 332144))] In [37]: cur.execute("select to_date(:0), to_timestamp(:1) from dual", [u'2013-03-12', u'2013-03-12 08:22:31.332144']) --------------------------------------------------------------------------- DatabaseError Traceback (most recent call last) /home/xxxxx/&lt;ipython-input-37-8af80e5fc40c&gt; in &lt;module&gt;() ----&gt; 1 cur.execute("select to_date(:0), to_timestamp(:1) from dual", [u'2013-03-12', u'2013-03-12 08:22:31.332144']) DatabaseError: ORA-01843: not a valid month In [38]: cur.execute("select to_date(:0), to_timestamp(:1) from dual", [u'2013-03-12', '2013-03-12 08:22:31.332144']) --------------------------------------------------------------------------- DatabaseError Traceback (most recent call last) /home/xxxx/&lt;ipython-input-38-bc628f006aa3&gt; in &lt;module&gt;() ----&gt; 1 cur.execute("select to_date(:0), to_timestamp(:1) from dual", [u'2013-03-12', '2013-03-12 08:22:31.332144']) DatabaseError: ORA-01843: not a valid month In [39]: cur.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS' NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'") In [40]: cur.execute("select to_date(:0), to_timestamp(:1) from dual", [u'2013-03-12', '2013-03-12 08:22:31.332144']) Out[40]: &lt;__builtin__.OracleCursor on &lt;cx_Oracle.Connection to refill_test02@MYDB&gt;&gt; In [41]: cur.fetchall() Out[41]: [(datetime.datetime(2013, 3, 12, 0, 0), datetime.datetime(2013, 3, 12, 8, 22, 31, 332144))] </code></pre> <p>For some reason, I can't use an unicode string for a timestamp parameter (IN[37]), what's even more strange is that after I do it I need to reset the session NLS formats before it works again with a normal string.</p> <p>I'm using: Cx_Oracle 5.1.2 python 2.7.3 Oracle 10.2.0.1.0</p> <p>Any ideas?</p> <p>Thank you for your time on reading this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload