我们在应用程序日志中看到很多"ORA-00936:缺少表达式"错误.Oracle是否有办法确定哪些语句失败?
我尝试查询v $ sql,但这些语句没有插入到该视图中,因为它们没有通过语法检查.
我们的C#应用程序使用Linq生成对Oracle数据库的查询.这使得从应用程序获取sql查询有点困难.我希望我能更容易地从Oracle获得它.
我有以下内容:(使用ipython)
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]: <__builtin__.OracleCursor on <cx_Oracle.Connection to refill_test02@MYDB>>
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]: <__builtin__.OracleCursor on <cx_Oracle.Connection to refill_test02@MYDB>>
In [36]: cur.fetchall()
Out[36]:
[(datetime.datetime(2013, 3, 12, 0, …Run Code Online (Sandbox Code Playgroud)