ORA-00907: right parenthesis not found
-
Hello, I've been working with the oracle for a while, and I'm having this problem in the query, returns the error: ORA-00907: right parenthesis not found, follows the same:
("""select ordem.id,ordem.data_prog,ordem.rms, ordem.pkpk, medida.ganho,ponto.descricao as ponto, unidade.id as id_unid, unidade.id_segmento as segmento,equipamento.id as id_equipamento,codigo.id, codigo.descricao from intranet.vb_item_ordem_servico ordem
join intranet.vb_ponto_medida medida on medida.id = ordem.id_ponto_medida join intranet.vb_ponto ponto on ponto.id = medida.id_vb_ponto join intranet.gm_arvore arvore on arvore.id = ponto.id_arvore join intranet.cd_unidade unidade on unidade.id = arvore.id_unidade join intranet.gm_equipamento_arvore equipamento on equipamento.id = arvore.id join intranet.ce_tipo_equipamento codigo on codigo.id = equipamento.id_tipo_equipamento where (ordem.data_prog between date_sub(to_date('{}', 'DD/MM/YYYY'), INTERVAL {} MONTH) and to_date('{}', 'DD/MM/YYYY')) AND codigo.id='{}' """).format(data_prog, intervalo,data_prog, id)
Somebody could tell me where I'm going.
Thank you.
-
I don't know Oracle, but yours
where
has a right relatives ')' that does not "home" with anyone, put on a qt-console terminal (I think it works on ipython tambem) and go sailing on the coding line and the opening and closing relatives are highlighted, did this with yourwhere
and with the response of the Rapahel and I found (in both) a close relatives "solder".where (ordem.data_prog between date_sub(to_date('{}', 'DD/MM/YYYY'), INTERVAL {} MONTH) and to_date('{}', 'DD/MM/YYYY')) AND codigo.id='{}' """).format(data_prog, intervalo,data_prog, id)
).format(data_prog, intervalo,data_prog, id)
^
Esse parenteses está "solteiro"