Decode in SQL
I have a SQL as below, I have added DECODE(a.onoff,'Y','2','1') to verify the value of TRXMODE, if a.onoff='Y', then TRXMODE=2 else TRXMODE=1. However, i still getting result with TRXMODE=2.
The value for column ONOFF is either Y or N, for bnkcd=7092, the ONOFF value is N, therefore I expect value for TRXMODE to be 1
SELECT b.bnkcd,DECODE((DECODE(a.bnkcd, NULL,'0','2'))||(DECODE(b.bnkcd, NULL, '0','2')), '22','2', '20','1', '02','1',DECODE(a.onoff,'Y','2','1'),'0')TRXMODE
FROM G39PART a, CTBANK b WHERE b.bnkcd='7092';