0
People, when executing the query below, the following error is occurring. By parsing, the error occurs when I put sum. For what reason?
"ORA-00918: column defined ambiguously 00918. 00000 - "column Ambiguously defined" *Cause:
*Action: Line error: 4 Column: 35"
Follow-up.
select
e.nm_fantasia_estab ESTABELECIMENTO,
t.ds_caixa CAIXA,
sum(tasy.obter_valor_trans_financ(nr_sequencia, 'E')) VL_ENTRADA, -- Esse
tasy.obter_valor_trans_financ é uma função
nvl(d.vl_saldo_inicial,'0') SALDO_INICIAL,
nvl(d.vl_saldo,'0')SALDO_FINAL
from tasy.caixa t
left join tasy.estabelecimento e on e.cd_estabelecimento = t.cd_estabelecimento
left join tasy.caixa_saldo_diario d on d.nr_seq_caixa = t.nr_sequencia
left join tasy.transacao_financeira f on f.NR_SEQUENCIA = t.NR_SEQUENCIA
where t.cd_estabelecimento = 241
group by e.nm_fantasia_estab, t.ds_caixa, nvl(d.vl_saldo_inicial,'0'), nvl(d.vl_saldo,'0');
Check this tasy function, it may be duplicating some field in select, usually happens when some filter is added and ends up duplicating, if not there, somewhere there is being duplicated, maybe even in left joins
– Darlei Fernando Zillmer
Wouldn’t that be the sequence ? If it exists in more than one table, you have to put the reference of which table it is coming from, to remove the ambiguity.
– Ailton Bayma
this @Ailtonbayma, worked out, that was it. Thank you
– renan bessa