回答:select case when length(a.维度)=3 then substring(a.维度,3,1) when length(a.维度)=4 then substring(a.维度,4,1) when length(a.维度)=5 then substring(a.维度,4,2) end 实际值 from (select case when '${指标}'='季度' then jd || jdid when '${指标}'='月份' then yf || yfidend 维度 from mwh0tn , am32r6 ) awhere substring('${指标值}',1,2)=substring(a.维度,1,2)