mysql 存储过程创建失败! 急救!!!
DELIMITER$$CREATEPROCEDURE`itrms`.`XQ_WC_JH_JTJ`(INdate_beginDATETIME,INhjdbh_inDECIM...
DELIMITER $$
CREATE
PROCEDURE `itrms`.`XQ_WC_JH_JTJ`(IN date_begin DATETIME,IN hjdbh_in DECIMAL,IN zfl_in DECIMAL,OUT count_out DECIMAL)
SELECT COUNT(xqjd.xh) totalCount
FROM (
SELECT * FROM (SELECT xq1.*,
(CASE WHEN xq1.XQZT
IN (0,20,21,22,23,25,24,30,51,615,215,62,63,65,60,52,1000,10) THEN 68
WHEN (xq1.XQZT=70 AND xq1.XH NOT IN (SELECT bq2.xh FROM bbxq bq2)) THEN 68
WHEN xq1.xqzt IN (40) THEN 67
WHEN ((bbjh1.bbzt BETWEEN 0 AND 30) OR bbjh1.bbzt IN (40,41,50,31))AND xq1.xqzt=70 THEN 69
WHEN xq1.xqzt=70 AND bbjh1.bbzt IN (60,61,70,80) THEN 88
WHEN bbjh1.bbzt IN (90) THEN 88 ELSE ' ' END)
HJDBH
FROM xq xq1
LEFT JOIN bbxq bq ON bq.XH=xq1.xh
LEFT JOIN bbjh bbjh1 ON bbjh1.bbxh=bq.BBXH ) cool
LEFT JOIN xqxysj xqxysj1 ON xqxysj1.SLADJBH=cool.ZFL AND xqxysj1.xqflbh=cool.hjdbh) xqjd
LEFT JOIN (SELECT xqcsjl2.xh,xqcsjl2.hjdbh,xqcsjl2.cfsj,xqcsjl2.jssj,MAX(xqcsjl2.JLBH) jlbh FROM xqcsjl xqcsjl2 GROUP BY xqcsjl2.xh ,xqcsjl2.HJDBH) csjl ON csjl.hjdbh=xqjd.hjdbh
LEFT JOIN xtyhb xtyhb1 ON xtyhb1.yhbh=xqjd.tjr
LEFT JOIN bmb bmb1 ON bmb1.bmbh=xtyhb1.bmbh
WHERE csjl.xh=xqjd.xh AND bmb1.SJBMBH IN (0)
AND csjl.cfsj>(SELECT DATE_ADD(date_begin, INTERVAL 0 DAY))
AND csjl.cfsj<(SELECT DATE_ADD(date_begin, INTERVAL 19 DAY))
AND xqjd.hjdbh=hjdbh_in AND xqjd.zfl=zfl_in
GROUP BY xqjd.ZFL
ORDER BY xqjd.xh
BEGIN
END$$
DELIMITER ;
Query : CREATE PROCEDURE `itrms`.`XQ_WC_JH_JTJ`(in date_begin datetime,in hjdbh_in DECIMAL,in zfl_in decimal,out count_out DECIMAL) ...
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT COUNT(xqjd.xh) totalCount into count_out
FROM (
SELECT * FROM (SELECT' at line 3
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000 展开
CREATE
PROCEDURE `itrms`.`XQ_WC_JH_JTJ`(IN date_begin DATETIME,IN hjdbh_in DECIMAL,IN zfl_in DECIMAL,OUT count_out DECIMAL)
SELECT COUNT(xqjd.xh) totalCount
FROM (
SELECT * FROM (SELECT xq1.*,
(CASE WHEN xq1.XQZT
IN (0,20,21,22,23,25,24,30,51,615,215,62,63,65,60,52,1000,10) THEN 68
WHEN (xq1.XQZT=70 AND xq1.XH NOT IN (SELECT bq2.xh FROM bbxq bq2)) THEN 68
WHEN xq1.xqzt IN (40) THEN 67
WHEN ((bbjh1.bbzt BETWEEN 0 AND 30) OR bbjh1.bbzt IN (40,41,50,31))AND xq1.xqzt=70 THEN 69
WHEN xq1.xqzt=70 AND bbjh1.bbzt IN (60,61,70,80) THEN 88
WHEN bbjh1.bbzt IN (90) THEN 88 ELSE ' ' END)
HJDBH
FROM xq xq1
LEFT JOIN bbxq bq ON bq.XH=xq1.xh
LEFT JOIN bbjh bbjh1 ON bbjh1.bbxh=bq.BBXH ) cool
LEFT JOIN xqxysj xqxysj1 ON xqxysj1.SLADJBH=cool.ZFL AND xqxysj1.xqflbh=cool.hjdbh) xqjd
LEFT JOIN (SELECT xqcsjl2.xh,xqcsjl2.hjdbh,xqcsjl2.cfsj,xqcsjl2.jssj,MAX(xqcsjl2.JLBH) jlbh FROM xqcsjl xqcsjl2 GROUP BY xqcsjl2.xh ,xqcsjl2.HJDBH) csjl ON csjl.hjdbh=xqjd.hjdbh
LEFT JOIN xtyhb xtyhb1 ON xtyhb1.yhbh=xqjd.tjr
LEFT JOIN bmb bmb1 ON bmb1.bmbh=xtyhb1.bmbh
WHERE csjl.xh=xqjd.xh AND bmb1.SJBMBH IN (0)
AND csjl.cfsj>(SELECT DATE_ADD(date_begin, INTERVAL 0 DAY))
AND csjl.cfsj<(SELECT DATE_ADD(date_begin, INTERVAL 19 DAY))
AND xqjd.hjdbh=hjdbh_in AND xqjd.zfl=zfl_in
GROUP BY xqjd.ZFL
ORDER BY xqjd.xh
BEGIN
END$$
DELIMITER ;
Query : CREATE PROCEDURE `itrms`.`XQ_WC_JH_JTJ`(in date_begin datetime,in hjdbh_in DECIMAL,in zfl_in decimal,out count_out DECIMAL) ...
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT COUNT(xqjd.xh) totalCount into count_out
FROM (
SELECT * FROM (SELECT' at line 3
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询