I'm trying to use this code below, but oracle returns me the following error:
ORA-00907: right parenthesis not found 00907. 00000 - "missing right parenthesis" * Cause:
* Action: Error on line: 30 Column: 10
I can not identify where the problem is.
select p.empresa as cod_empresa, p.filial as cod_estab, gp.codigo as cod_cliente, td.sigla as esp_docto, fd.serie as serie_docto,
fd.documentodigitado as num_docto, p.parceladigitada as parcela, p.banco as cod_banco, tc.codigo as cod_carteira, p.numerobanco as nosso_numero,
p.datainclusao as dt_emissao, p.datavencimento as dt_ven_ori, p.vctoprorrogado as dt_vencimento, p.valor as val_documento, p.valor - p.valoresbaixados as val_saldo,
p.percentualmora as pct_juros_dia, p.percentualmulta as pct_multa, fd.enviadoserasa as enviado, p.handle as num_tit_unico,
( SELECT CC.ESTRUTURA FROM BENNERCORP.CM_ITENS CI
LEFT JOIN BENNERCORP.CT_CC CC ON CC.HANDLE = CI.CENTROCUSTO
where CI.documento = fd.handle
and ROWNUM <= 1
order by CI.valorliquido desc ) as cod_unid_negoc,
kr.DSREGIAOCOMERCIAL as cod_canal_venda from bennercorp.fn_parcelas p
inner join bennercorp.fn_documentos fd on fd.handle = p.documento
and fd.ENTRADASAIDA = 'S'
AND fd.TIPODEMOVIMENTO IN (1, 2)
and fd.ABRANGENCIA <> 'R'
AND fd.ABRANGENCIA <> 'F'
AND fd.ABRANGENCIA <> 'B'
AND fd.ABRANGENCIA <> 'D'
AND fd.ABRANGENCIA <> 'G'
AND fd.ABRANGENCIA <> 'H'
AND fd.documentodigitado NOT like '%CON%'
AND fd.documentodigitado NOT like '%CTR%'
AND fd.documentodigitado NOT like '%FQF%'
AND UPPER(fd.documentodigitado) NOT like '%CONT%'
AND fd.documentodigitado NOT like '%FQV%'
inner join bennercorp.fn_tiposdocumentos td on td.handle = fd.tipodocumento
inner join bennercorp.gn_pessoas gp on gp.handle = fd.pessoa
left join bennercorp.fn_tiposcobrancas tc on tc.handle = p.tipocobranca
inner join bennercorp.empresas e on e.handle = p.empresa
left join bennercorp.k_regiacao_comercial kr on kr.handle = gp.K_CDUFREGIAOCOMERCIAL
where p.vctoprorrogado < current_date
and p.dataliquidacao is null
and p.ehadiantamento = 'N'
and p.emaberto = 'S'
and p.parcelacancelada = 'N'