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
展开
 我来答
artistrat
2011-07-01 · 超过10用户采纳过TA的回答
知道答主
回答量:31
采纳率:0%
帮助的人:0
展开全部
BEGIN应该放到CREATE之后、SELECT前面去吧
追问
确实该放到begin后面
可是 还有其他的问题,仍然没有完成!
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式