Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a better way of writing this...

Status
Not open for further replies.

INFEXP

Programmer
Jul 1, 2003
8
GB
Is there a better way of writing this...code

IIF(
(OUT_REC_TYPE ='10')
OR
(OUT_REC_TYPE = '12')
OR
(OUT_REC_TYPE = '14')
OR
(OUT_REC_TYPE = '16')
OR
(OUT_REC_TYPE = '18')
OR
(OUT_REC_TYPE = '20')
OR
(OUT_REC_TYPE = '22')
OR
(OUT_REC_TYPE = '24')
OR
(OUT_REC_TYPE = '25')
OR
(OUT_REC_TYPE = '26')
OR
(OUT_REC_TYPE = '27')
OR
(OUT_REC_TYPE = '28')
OR
(OUT_REC_TYPE = '29')
OR
(OUT_REC_TYPE = '30')
OR
(OUT_REC_TYPE = '31')
OR
(OUT_REC_TYPE = '32')
OR
(OUT_REC_TYPE = '34')
OR
(OUT_REC_TYPE = '35')
OR
(OUT_REC_TYPE = '36')
OR
(OUT_REC_TYPE = '39')
OR
(OUT_REC_TYPE = '43')
OR
(OUT_REC_TYPE = '49')
OR
(OUT_REC_TYPE = '50')
OR
(OUT_REC_TYPE = '52')
OR
(OUT_REC_TYPE = '53')
OR
(OUT_REC_TYPE = '54')
OR
(OUT_REC_TYPE = '58')
OR
(OUT_REC_TYPE = '60')
OR
(OUT_REC_TYPE = '62')
OR
(OUT_REC_TYPE = '64')
OR
(OUT_REC_TYPE = '66')
OR
(OUT_REC_TYPE = '72')
OR
(OUT_REC_TYPE = '74')
OR
(OUT_REC_TYPE = '76')
OR
(OUT_REC_TYPE = '78')
OR
(OUT_REC_TYPE = '96')
OR
(OUT_REC_TYPE = '98')
OR
(OUT_REC_TYPE = '99'),'PER',IIF(OUT_REC_TYPE = '44' OR OUT_REC_TYPE = '46','SGL',IIF(OUT_REC_TYPE = '48','TRF')))
 
decode(out_rec_type, '10' or '12' or '14'..., 'PER', '44' or '46', 'SGL', '48', 'TRF')
 
u can use instr operator as given here for long or statement
as given below
this should work fine right
this is under the assuption that comma does not appear in
the data OUT_REC_TYPE
u may use it for the second or also if reqd

IIF(
instr(',10,12,14,16,18,20,22,24,25,26,27,28,29,30,31,
32,34,35,36,39,43,49,50,52,53,54,58,60,62,64,66,72,74,
76,78,96,98,99,',OUT_REC_TYPE,1)>0),'PER',
IIF(OUT_REC_TYPE = '44' OR OUT_REC_TYPE = '46',
'SGL',IIF(OUT_REC_TYPE = '48','TRF')))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top