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'
Condition with special DECODE
-
- Moderador
- Posts: 641
- Joined: Mon, 03 Sep 2007 3:26 pm
- Location: Fortaleza - CE
att,
Daniel N.N.
Daniel N.N.
I came across this condition and decode combined, I could not hold the laughter.
It already appeared here at work, I called the analyst to show. He told me: if he was there there is some reason, he does not change.
: -The
I do not know what was worse, the code or opinion of it.
PS: I was a trainee.
: -The
I do not know what was worse, the code or opinion of it.
PS: I was a trainee.
- gpilger
- Rank: Programador Júnior
- Posts: 29
- Joined: Wed, 21 Apr 2010 3:34 pm
- Location: Novo Hamburgo - RS
Gilson Pilger
"Por não saber que erra impossível, ele foi lá e fez" autor desconhecido
"Por não saber que erra impossível, ele foi lá e fez" autor desconhecido
He must have done this to match a value casso the return is null. Something NVL (NULL, 101). Because null is not equal to anything.
-
- Rank: Estagiário Pleno
- Posts: 3
- Joined: Tue, 16 Jan 2018 1:40 pm
I believe this would be a better option ...
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 ( R.SET_OF_BOOKS_ID <> 0 AND
P.APPLICATION_ID = R.SET_OF_BOOKS_ID ) OR
(P.APPLICATION_ID = 101)
--
AND R.PERIOD_NAME = P.PERIOD_NAME
AND R.TO_CURRENCY_CODE = 'IGPM'
-
- Moderador
- Posts: 641
- Joined: Mon, 03 Sep 2007 3:26 pm
- Location: Fortaleza - CE
att,
Daniel N.N.
Daniel N.N.
Thiago Rawel wrote: I believe that this would be a better option .../ quote]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 ( R.SET_OF_BOOKS_ID <> 0 AND P.APPLICATION_ID = R.SET_OF_BOOKS_ID ) OR (P.APPLICATION_ID = 101) -- AND R.PERIOD_NAME = P.PERIOD_NAME AND R.TO_CURRENCY_CODE = 'IGPM'
. A major problem is that:are two totally different information. It is comparing apple with bicycle.P.APPLICATION_ID = R.SET_OF_BOOKS_ID
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest