Toad World® Forums

Case Statement in Where clause


#1

I am having an issue in the where clause case statement of this select. please help me out

it says 00907. 00000 - “missing right parenthesis”

and e.entype = ‘PRT’

and

(case

when (t.trans_code not in (‘ABDC’))

then

(

(smd.user_group_desc3 = ‘12’ and sm.process_sec_type <> ‘OPOPSW’ and nvl(sw.pay_receive_ind, ‘0’) = ‘C’) or

(smd.user_group_desc3 = ‘12’ and sm.process_sec_type = ‘OPOPSW’) or

(smd.user_group_desc3 not in (‘3’, ‘25’, ‘12’)) or

((smd.user_group_desc3 = ‘3’ and (trim(sm.ticker) = td.transaction_notes) or (t.user_char3 = ‘FXO_EXERCISE’ and sm.ticker <> ‘USD’) and e.user_field3 = ‘CASH’)

or

(smd.user_group_desc3 = ‘3’ and trim(sm.ticker) = td.transaction_notes and e.user_field3 = ‘FUT’

and exists

(select distinct ec.user_float10

from pace_masterdbo.codes c,

pace_masterdbo.code_values cv,

rulesdbo.entity_extension ec

where c.short_desc = ‘ILFUTURESFXF’

and c.instance = cv.code_inst

and ec.user_float10 = rtrim(cv.short_desc)

and trim(ec.entity_id) = trim(ee.user_char1)))

or

(smd.user_group_desc3 = ‘25’ and t.trade_currency <> ‘USD’)

)

)

end)=1

and e.user_float5 is not null


#2

I think we really need the full statement to be able to help fully. We’ve no idea what else is before the first line.

Can you repost the full statement? Ta


#3

issue is only with that case statement . if i remove that entire AND clause having Case statement it works fine