cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number

Posted by Joao Figueiredo on Stack Overflow See other posts from Stack Overflow or by Joao Figueiredo
Published on 2012-10-15T09:33:34Z Indexed on 2012/10/15 9:37 UTC
Read the original article Hit count: 2992

Filed under:
|
|
|

I've a cron scheduled query which is failing with,

File "./run_ora_query.py", line 69, in db_lookup
  cursor.execute(query, dict(time_key=time_key) )
cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number

where

>>> dict(time_key=time_key)                                            
{'time_key': '12/10/2012 19:12:00'}

I'm using a .yaml file to update the last time_key after each query runs, where the relevant parameters are,

{query: 'select session_mode, inst_id, user_name, schema_name, os_user, process_id,
process_mb_use, process_name, to_char(datet,''dd-mm-yyyy hh24:mi'') as DATETIME from     os_admin.mem_usage where data > TO_DATE(:time_key,''dd-mm-yyyy hh24:mi:ss'') order by datet,
inst_id, os_user', time_key: '12/10/2012 19:12:00'}

Where is the culprit for this error?

© Stack Overflow or respective owner

Related posts about python

Related posts about Oracle