What's wrong with this query?

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2009
Posts: 1
Reputation: tombatista is an unknown quantity at this point 
Solved Threads: 0
tombatista tombatista is offline Offline
Newbie Poster

What's wrong with this query?

 
0
  #1
May 31st, 2009
  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
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 127
Reputation: slate is an unknown quantity at this point 
Solved Threads: 31
slate slate is offline Offline
Junior Poster

Re: What's wrong with this query?

 
0
  #2
Jun 1st, 2009
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
  1. :DATAI
and
  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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC