具有和存储过程异曲同工之妙,就是写的时候稍微复杂了些,但是比写个存储过程要省事的多啦。 它的边界值的设置比存储过程要省事的多。 哈哈^_^ SELECT SOA_GET_NENAME(NE_ID,NE_TYPE) VIRCOLUMN_0, FIRST_RESULT VIRCOLUMN_1, G42 VIRCOLUMN_2, CASE WHEN (G42 >= 93 ) THEN 5 WHEN (G42 >= 88 ) THEN 3 + (G42 - 88)*0.4 WHEN (G42 <= 78 ) THEN 0 WHEN (G42 <= 88 ) THEN 3 + (G42 - 88)*0.3 ELSE 0 END , G66 VIRCOLUMN_23, case WHEN (G66 >= 130 ) THEN 5 WHEN (G66 >= 100 ) THEN 3 + (G66 - 100)*0.4/6 WHEN (G66 <= 40 ) THEN 0 WHEN (G66 <= 100 ) THEN 3 + (G66 - 100)*0.3/6 ELSE 0 END FROM CHK_GRADE_FACTHOUR WHERE ( (chk_grade_facthour.COMPRESS_DATE = '2006-02-14') ) AND (chk_grade _facthour.NE_TYPE IN (10000,10003) AND chk_grade_facthour.NE_ID IN (-1744891292,1948613501,867223656 ,-402456014,-1128953347,91461549,414603468,-1458085134,-578147474,1478501655,202839087,-75534827)) a nd (1=1) ORDER BY 1,2