I set up a SELECT with the intention to seek the record that has the highest bid value, see:
select CODIGO_PROPONENTE
INTO :P27_COD_PROPONENTE
from LIC_LICITACAO_ITENS_PREGAO
where VALOR_LANCE = (SELECT MAX(VALOR_LANCE) FROM LIC_LICITACAO_ITENS_PREGAO
where
CODIGO_LICITACAO = :G_NR_LICITACAO and
ID_CIDADE = :G_ID_CIDADE and
LOTE = :P27_GUARDA_LOTE and
CODIGO_ITEM = :P27_GUARDA_CODIGO_ITEM and
MOSTRAR_TELA_LANCE = '1'
) AND
CODIGO_LICITACAO = :G_NR_LICITACAO and
ID_CIDADE = :G_ID_CIDADE and
LOTE = :P27_GUARDA_LOTE and
CODIGO_ITEM = :P27_GUARDA_CODIGO_ITEM and
MOSTRAR_TELA_LANCE = '1';
However, I believe that it is kind of gambiarra this, because when there are 2 records with the same value , already of the error ... I also realize that sometimes the code fails to seek
in this direction there, someone has a tip that really solves it ??