1
--这一行的:SUBSTR(‘0602+0202‘, 5, 1) 想把中间的运算符“+”截取出来,但是截取出来是字符串,而不是round(val1+val2)的运算形式,所以报错了:
SELECT round(t3.FVALUE1 SUBSTR(‘0602+0202‘, 5, 1) t4.FVALUE2, 4) FVALUE,
2 T4.FDEPTCODE, 3 T3.FPERSONID, 4 T3.FORGID 5 FROM (SELECT T1.FVALUE FVALUE1, 6 ‘‘ FVALUE2, 7 T1.FDEPTCODE, 8 T1.FPERSONID, 9 T1.fdate, 10 T1.FORGID 11 FROM APP_LHZ_DAY T1, App_Lhz_Basetypes T2 12 WHERE T1.FTYPEID = T2.FID 13 AND T2.FZBCODE = SUBSTR(‘0602+0202‘, 1, 4) 14 AND T1.FDATE = 15 to_date(‘2019-06-24‘, ‘yyyy-MM-dd‘)) T3, 16 (SELECT ‘‘ FVALUE1, 17 T1.FVALUE FVALUE2, 18 T1.FDEPTCODE, 19 T1.FPERSONID, 20 T1.FORGID 21 FROM APP_LHZ_DAY T1, App_Lhz_Basetypes T2 22 WHERE T1.FTYPEID = T2.FID 23 AND T2.FZBCODE = SUBSTR(‘0602+0202‘, 6, 4) 24 AND T1.FDATE = 25 to_date(‘2019-06-24‘, ‘yyyy-MM-dd‘)) T4 26 WHERE T3.FDEPTCODE = T4.FDEPTCODE 27 AND T3.FPERSONID = T4.FPERSONID 28 AND T3.FORGID = T4.FORGID 29 AND T3.FDEPTCODE = T4.FDEPTCODE 30 and t4.FVALUE2 <> 0 31 ORDER BY FDEPTCODE, FPERSONID
1 --这一行的:SUBSTR(‘0602+0202‘, 5, 1) 想把中间的运算符“+”截取出来,但是截取出来是字符串,而不是round(val1+val2)的运算形式,所以报错了: 2 SELECT round(t3.FVALUE1 SUBSTR(‘0602+0202‘, 5, 1) t4.FVALUE2, 4) FVALUE, 3 T4.FDEPTCODE, 4 T3.FPERSONID, 5 T3.FORGID 6 FROM ( 7 SELECT T1.FVALUE FVALUE1, 8 ‘‘ FVALUE2, 9 T1.FDEPTCODE, 10 T1.FPERSONID, 11 T1.fdate, 12 T1.FORGID 11 FROM APP_LHZ_DAY T1, App_Lhz_Basetypes T2 13 WHERE T1.FTYPEID = T2.FID 14 AND T2.FZBCODE = SUBSTR(‘0602+0202‘, 1, 4) 15 AND T1.FDATE = to_date(‘2019-06-24‘, ‘yyyy-MM-dd‘) 16 ) T3, 17 (SELECT ‘‘ FVALUE1, T1.FVALUE FVALUE2, T1.FDEPTCODE, T1.FPERSONID, T1.FORGID FROM APP_LHZ_DAY T1, App_Lhz_Basetypes T2 WHERE T1.FTYPEID = T2.FID AND T2.FZBCODE = SUBSTR(‘0602+0202‘, 6, 4) AND T1.FDATE = to_date(‘2019-06-24‘, ‘yyyy-MM-dd‘) 18 ) T4 19 WHERE T3.FDEPTCODE = T4.FDEPTCODE AND T3.FPERSONID = T4.FPERSONID 20 AND T3.FORGID = T4.FORGID AND T3.FDEPTCODE = T4.FDEPTCODE 21 and t4.FVALUE2 <> 0 22 ORDER BY FDEPTCODE, FPERSONID
以上SQL报错,报错在第一行,原因:第一行的
解决方法如下: