mysql存储过程1046错误是怎么回事呢?
DELIMITER$$DROPPROCEDUREIFEXISTSupdateData$$CREATEPROCEDUREupdateData()----实例--存储过程名为...
DELIMITER $$
DROP PROCEDURE
IF EXISTS updateData$$
CREATE PROCEDURE updateData () --
-- 实例
-- 存储过程名为:updateData
-- 参数为:date_day日期格式:2008-03-08
--
BEGIN
-- 更新表
/*排量 1:不限 2:1.0及以下 3:1.1-1.6L 4:1.7-2.0L 5:2.1-2.5L 6:2.6-3.0L 7:
3.1-4.0L 8:4.0以上*/
UPDATE m_carlistinfo_body a
SET a.discharge2 = CASE
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 1.0 THEN
2
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 1.1
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 1.6 THEN
'3'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 1.7
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 2.0 THEN
'4'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 2.1
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 2.5 THEN
'5'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 2.6
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 3.0 THEN
'6'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 3.1
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 4.0 THEN
'7'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 8.0 THEN
'8'
ELSE
'1'
END ; END$$
DELIMITER ;
这是我写的存储过程,为什么不能编译,单条拿出来执行是没问题的
现在在navicat就报错了
[Err] 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 'DELIMITER' at line 83 展开
DROP PROCEDURE
IF EXISTS updateData$$
CREATE PROCEDURE updateData () --
-- 实例
-- 存储过程名为:updateData
-- 参数为:date_day日期格式:2008-03-08
--
BEGIN
-- 更新表
/*排量 1:不限 2:1.0及以下 3:1.1-1.6L 4:1.7-2.0L 5:2.1-2.5L 6:2.6-3.0L 7:
3.1-4.0L 8:4.0以上*/
UPDATE m_carlistinfo_body a
SET a.discharge2 = CASE
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 1.0 THEN
2
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 1.1
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 1.6 THEN
'3'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 1.7
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 2.0 THEN
'4'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 2.1
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 2.5 THEN
'5'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 2.6
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 3.0 THEN
'6'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 3.1
AND substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) <= 4.0 THEN
'7'
WHEN substring(
a.Discharge,
1,
LENGTH(trim(a.Discharge)) - 1
) >= 8.0 THEN
'8'
ELSE
'1'
END ; END$$
DELIMITER ;
这是我写的存储过程,为什么不能编译,单条拿出来执行是没问题的
现在在navicat就报错了
[Err] 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 'DELIMITER' at line 83 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询