Test = '''
SELECT      /*+ INDEX (s_evt_act acc_temp_teste) */ todo_cd tipoemail, 
            name subject,  email_sndr_addr remetente, 
            evt_stat_cd status, 
            to_char(trunc(created), 'yyyy-mm-dd') data, 
            COUNT(1) quantidade
FROM        sblprod.s_evt_act
WHERE       created >= TO_DATE(:DATAI, 'yyyy-mm-dd hh24:mi:ss')
AND         created <= TO_DATE(:DATAF, 'yyyy-mm-dd hh24:mi:ss')
AND         todo_cd IN ('Email - Entrada','Redução de Preço','Fax - Entrada','Email - Saída')
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

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

:DATAI

and

:DATAF

bind variables are not in the format 'yyyy-mm-dd hh24:mi:ss'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.