Cute Code, Zero Logic!

Este forum é dedicado a códigos errados que se encontram por aí, ou seja, coisas que não se deve fazer de jeito nenhum! Não coloque neste forum dúvidas! (apenas situações bizarras do nosso dia a dia :-)
Post Reply
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

This is not an case where the programmer made an error due to ignorance of some Oracle feature. Here, it is clear that the programmer has been lost in a simple IF Else! Logic passed away.

Check:

Select all

if :BL_CLIENTE.NM_CLIENTE IS NULL then 
    PR_INFORMACAO('Não é permitido abrir essa tela enquanto registro não for pesquisado.');  
			 	   
else 
    if ( :bl_cliente.nm_cliente is null ) then 
       ln_mens := fu_alerta('Favor pesquisar um registro.',1); 
       raise form_trigger_failure; 
    end if; 
. 
. 
. 
end if;
He does an IF <condition>. In the Else, it does the same <condition> done above! (That is, of course it will never enter.
lodvini
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 11
Joined: Thu, 16 Jun 2005 7:59 am
Location: Sapiranga - RS

But look ... he at least changed the message ... hehehehehe
NaPraia
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 88
Joined: Fri, 22 Feb 2008 8:24 am
Location: Floripa - SC

I think he forgot a not in the IF inside the Else,
but of course, it is rebundancia he put a not inside the else, but at least it would work
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests