正确:select t.*, f_get_dicmc('RYLB_SJBD',t.rylx ) as rylx
from t_tjfx_syrk_sjbdb t where t.sjly='1' and t.batchno='33238ED6-0E3D-4275-9B5B-33F46FD792AA' order by t.xh;
create or replace function f_get_dicmc(v_zdlb varchar2,v_dm varchar2)
return varchar2
as
v_mc varchar2(250);
begin
select MC into v_mc from t_common_dictionary where zdlb=v_zdlb and dm=v_dm;
return v_mc;
end;
错误:select XH as xh,SFZH as sfzh,XM as xm,XB as xb,MZ as mz,
(select mc from t_common_dictionary where zdlb ='RYLB_SJBD'
#if($rylx && !$rylx.equals(""))
and dm = #[rylx]
#end ) as rylx,
HJDQH as hjdqh,HJDXZ as hjdxz,
DJDWDM as djdwdm,DJDWMC as djdwmc,
DJRXM as djrxm,DJSJ as djsj,SJBDSJ as sjbdsj
from t_tjfx_syrk_sjbdb where 1=1
#if($batchno && !$batchno.equals(""))
and batchno = #[batchno]
#end
#if($sjly && !$sjly.equals(""))
and sjly = #[sjly]
#end
order by xh
insert into t_common_dictionary values('11800452','RYLB_SJBD','人员类别_数据比对','1','常住人口','','','1',null);
insert into t_common_dictionary values('11800453','RYLB_SJBD','人员类别_数据比对','2','流动人口','','','1',null);
insert into t_common_dictionary values('11800454','RYLB_SJBD','人员类别_数据比对','5','寄住人口','','','1',null);
insert into t_common_dictionary values('11800455','RYLB_SJBD','人员类别_数据比对','6','从业人员','','','1',null);
insert into t_common_dictionary values('11800456','RYLB_SJBD','人员类别_数据比对','7','就学人员','','','1',null);