View Single Post
 
Old August 25th, 2009, 02:53 AM
rupen rupen is offline
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default CASE in where clause.

Hi,
wanted to include where clause conditionally (depends on variable value passed to procedure)

Code:
select main_acnt_code as code, main_acnt_name as name
from fm_main_account
where MAIN_FRZ_FLAG = 'N'
and case in_Code
        when 'CAPEX' THEN main_class_code_05 = 'Y';
        when 'MAIN_ACC2' THEN main_class_code_02 = 'Y';
     end case;
but error reads as "missing keywords " at line "when'CAPEX'THENmain_class_code_05 = 'Y';"

any idea how can we make select statement's where clause dynamic ??