WHERE (CASE WHEN'${org_ tree}' IN ('0099','0199','0299','0399',0499')
THEN LEVEL_SCD_ORG_NO in('"+ REPLACE(${org tree} ,",",",")+"') ELSE ORG in ('${org_tree}') END)
where 1=1
${if(find(org_tree,"0099,0199,0299,0399,0499")>0,"and LEVEL_SCD_ORG_NO in('"+ REPLACE(org_tree ,",",",")+"')","and ORG in ('"+org_tree+"')")}
=sql("FRDemo", "SELECT * FROM YourTable WHERE " +
if(${org_tree} in ('0099','0199','0299','0399','0499'),
"LEVEL_SCD_ORG_NO in ('" + REPLACE(${org_tree}, ",", "','") + "')",
"ORG in ('" + ${org_tree} + "')"
), 3)