Aprenda PL/SQL

Condition with DECODE special

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 :-)
  

Poston Fri, 05 Apr 2013 3:14 pm

I came across this condition and DECODE combined, I couldn't hold back the laugh.

Code: Select all
SELECT R.SET_OF_BOOKS_ID SET_OF_BOOKS_ID,
       R.PERIOD_NAME PERIOD_NAME,
       R.TO_CURRENCY_CODE TO_CURRENCY_CODE,
       R.AVG_RATE AVG_RATE
  FROM APPS.GL_TRANSLATION_RATES R,
APPS.GL_SETS_OF_BOOKS S,
APPS.GL_PERIOD_STATUSES P
WHERE R.SET_OF_BOOKS_ID = S.SET_OF_BOOKS_ID
   AND S.SET_OF_BOOKS_ID = P.SET_OF_BOOKS_ID
--
   AND P.APPLICATION_ID = DECODE(R.SET_OF_BOOKS_ID, 0, 101, 101)
--
   AND R.PERIOD_NAME = P.PERIOD_NAME
   AND R.TO_CURRENCY_CODE = 'IGPM'
DanielNN
Location: Fortaleza - CE

att,

Daniel N.N.

Poston Tue, 10 Sep 2013 11:49 am

It appeared that here at work, I called the analyst to show. He said: If there was any reason, does not change.
:-o
I don't know what was worse, the code or his opinion.
PS: I was an intern.
djoq

Poston Tue, 10 Sep 2013 1:32 pm

Code: Select all
DECODE (R . SET_OF_BOOKS_ID, 0, 101, 101)
hehehehehe I love this session of the forum:-D
dr_gori
Location: Porto Alegre - RS

Thomas F. G
https://www.patreon.com/glufke

Poston Tue, 10 Sep 2013 2:12 pm

Not to mention that I wanted to match (I don't even know if I can say that, given the constant disguised as decode) APPLICATION_ID with SET_OF_BOOKS_ID.
DanielNN
Location: Fortaleza - CE

att,

Daniel N.N.

Poston Fri, 12 Sep 2014 9:12 am

He must have done it to match a value is null return casso. Something nvl (null .101). Because null is not equal to nothing.
gpilger
Location: Novo Hamburgo - RS

Gilson Pilger
"Por não saber que erra impossível, ele foi lá e fez" autor desconhecido

Poston Fri, 19 Jan 2018 10:41 am

Topic under translation. Come back later. (This is an automatic message)
thiago rawel

Poston Fri, 19 Jan 2018 10:59 am

Topic under translation. Come back later. (This is an automatic message)
DanielNN
Location: Fortaleza - CE

att,

Daniel N.N.

Poston Thu, 25 Jan 2018 7:06 pm

Topic under translation. Come back later. (This is an automatic message)
dr_gori
Location: Porto Alegre - RS

Thomas F. G
https://www.patreon.com/glufke



Return to Doubtful codes

Who is online

Users browsing this forum: No registered users and 2 guests