0
제발 아무도 왜이 stored procedure
이 작동하지 않는지, 왜 내가 wrong.It 구문 오류를 계속하고 있는지 말해 줄 수 있습니다.준비된 문 쿼리 구문 오류
puserid and plimit
은 프로 시저에서 전달 된 매개 변수입니다.
DECLARE uid BIGINT;
DECLARE rangee TINYINT;
SET @uid = puserid;
SET @rangee = plimit * 15;
PREPARE STMT FROM
'IF((SELECT count(type) from notificationrecievers nr where
nr.status=0 and nr.recieverid=?) = 0) THEN
select nr.type,n.senderid,n.postid,u.name,nr.status
from
user u,notifications n,notificationrecievers nr where
nr.recieverid=? and u.userid=n.senderid and
nr.notificationid=n.notid order by n.notid desc
limit 15 OFFSET ?;
ELSE
select nr.type,n.senderid,n.postid,u.name,nr.status
from
user u,notifications n,notificationrecievers nr where
nr.recieverid=? and u.userid=n.senderid and nr.status=0 and
nr.notificationid=n.notid order by n.notid desc;
END IF;';
EXECUTE STMT USING @uid,@uid,@rangee,@uid;
여기 오류가 있습니다.
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 'IF((SELECT count(type) from notificationrecievers nr where nr.status=0 and nr.r' at line 1
나는이 질문을 편집했다. – Mj1992
언제이 오류가 발생합니까? PROCEDURE를 생성하는 동안 또는 EXECUTING 중에 실행합니까? 나는이 절차를 잘 만들 수 있었다. – SparKot
프로 시저를 실행하는 동안이 오류가 발생합니다. – Mj1992