,mysql 쿼리의 문제점은 무엇입니까? 나는 다음과 MySQL의 쿼리를 사용
DELIMITER $$
DROP PROCEDURE IF EXISTS `allied`.`aboutus_delete`$$
CREATE DEFINER=`allied`@`%` PROCEDURE `aboutus_delete`(
IN p_Id int(11)
)
BEGIN
if exists( select aboutUsId
from aboutus
where aboutUsId=p_id
and isDeleted=0
)
update aboutus set isDeleted=1 where aboutUsId=p_id
else
select 'No record to delete'
END$$
DELIMITER ;
하지만 난 그것을 실행할 때이 오류가 ...
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
'update aboutus set isDeleted=1 where aboutUsId=p_id
else
select 'No record to' at line 6
편집 : 세미콜론을 사용하여에
하지 않는 것 작품,
if exists(select aboutUsId from aboutus where aboutUsId=p_id and
isDeleted=0) then
update aboutus set isDeleted=1 where aboutUsId=p_id;
else
select 'No record to delete';
이것은 쿼리가 아니므로 프로 시저 스크립트 – lexu
@lexu 나중에 프로 시저를 만들지 만 왜 그 오류가 발생합니까? 완전성을 위해 – bala3569
- MySQL에서 SP 내부에 세미콜론이 필요합니까? – Axarydax