我写了一个语句,用了switch 函数,想问问switch里面还能再嵌套函数吗
select useyear,usemonth,
${switch(p_jb,1,"syb as bm ",2,"dept1 as bm",3,"dept2 as bm"),
count(fnumber) from hr_entryjob_v a
where
${switch(p_jb,1,"syb ='"+${s_syb}+"' ",2,"dept1 ='"${+s_syb}+"' ",3,"dept2 ='"+${s_syb}+"'")--这个地方如果能嵌套格式是什么样呢
and useyear=to_number(to_char(to_date('${s_day}','yyyy-mm-dd'),'yyyy'))
and usemonth=to_number(to_char(to_date('${s_day}','yyyy-mm-dd'),'mm'))
and
FEnterDate <=to_date('${s_day}','yyyy-mm-dd')
and (FLeftDate >to_date('${s_day}','yyyy-mm-dd') or FLeftDate is null)
and deptid in(
select deptid from pub_dept start with deptid='${p_deptid}'
connect by parentdeptid=prior deptid)
group by useyear,usemonth,${switch(p_jb,1,"syb ",2,"dept1 ",3,"dept2")}
order by useyear,usemonth