943,692 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 523
  • Python RSS
May 31st, 2009
0

What's wrong with this query?

Expand Post »
Python Syntax (Toggle Plain Text)
  1. Test = '''
  2. SELECT /*+ INDEX (s_evt_act acc_temp_teste) */ todo_cd tipoemail,
  3. name subject, email_sndr_addr remetente,
  4. evt_stat_cd status,
  5. to_char(trunc(created), 'yyyy-mm-dd') data,
  6. COUNT(1) quantidade
  7. FROM sblprod.s_evt_act
  8. WHERE created >= TO_DATE(:DATAI, 'yyyy-mm-dd hh24:mi:ss')
  9. AND created <= TO_DATE(:DATAF, 'yyyy-mm-dd hh24:mi:ss')
  10. AND todo_cd IN ('Email - Entrada','Redução de Preço','Fax - Entrada','Email - Saída')
  11. GROUP BY todo_cd, name, email_sndr_addr, evt_stat_cd, to_char(trunc(created), 'yyyy-mm-dd');'''


I need to run this query in Oracle and perform an insert into a table of postgre database. Queries work with minors, but this generates an error:


Traceback (most recent call last):
File "C:\Monitoramentos\carga\s_evt_act_carga.py", line 62, in <module>
curSiebel.execute(Oracle,{'DATAI': atualini, 'DATAF': atualfim})
cx_Oracle.DatabaseError: ORA-00911: invalid character
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tombatista is offline Offline
1 posts
since May 2009
Jun 1st, 2009
0

Re: What's wrong with this query?

This is not a python issue.
However...
This oracle error comes out, when in some expression an implicit or explicit conversion fails on some line and field value.


Most likely your
Python Syntax (Toggle Plain Text)
  1. :DATAI
and
Python Syntax (Toggle Plain Text)
  1. :DATAF
bind variables are not in the format 'yyyy-mm-dd hh24:mi:ss'
Last edited by slate; Jun 1st, 2009 at 8:11 am.
Reputation Points: 56
Solved Threads: 65
Posting Whiz in Training
slate is offline Offline
242 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: first time programmer stuck
Next Thread in Python Forum Timeline: Python with Cygwin





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC