我在我的sql中创建存储过程但是收到错误,错误显示如下,帮我解决错误:你的sql语法出错:ckeck对应你的MYSQL的手册
服务器版本采用正确的语法,以便在' END'附近使用在第13行
DELIMITER $$
DROP PROCEDURE IF EXISTS myhealthcamp.area $$
CREATE PROCEDURE myhealthcamp.area
(
IN id INT,
IN ar VARCHAR(45)
)
BEGIN
if exists (select area_id from area where area_id = id)
Then
update area set areaname = ar where area_id=id;
else
insert into area(area_id, areaname) values(id,ar);
END IF
END $$
DELIMITER ;
答案 0 :(得分:1)
答案 1 :(得分:0)
DROP PROCEDURE IF EXISTS myhealthcamp.area $$
CREATE PROCEDURE myhealthcamp.area
(
IN id INT,
IN ar VARCHAR(45)
)
BEGIN
if exists (select area_id from area where area_id = id)
Then
update area set areaname = ar where area_id=id;
else
insert into area(area_id, areaname) values(id,ar);
END IF;
分号丢失
由于 Sanil