我在phpmyadmin中运行脚本时在mySQL
中有一个存储过程,它会出现语法错误。当手动创建时,执行.Anyhelp将不胜感激
当我运行SQL
查询时,当我手动创建phpmyadmin存储过程函数时,它会显示错误
CREATE PROCEDURE `sp_ConsolidatedFollowFeedUserList`(
_uid INT,
_startTime INT,
_endTime INT,
_activityType VARCHAR(150),
`_follow_to` INT,
`_offset` INT,
`_limit` INT
)
BEGIN
SELECT
feed.id `feed_id`,
activity.id ` activity_id`,
activity.uid AS `uid`,
activity.source_id AS follow_to,
activity.activity_type,
activity.source_id,
activity.parent_id,
activity.parent_type,
activity.post_id
FROM
`user_feed` feed
JOIN user_activity activity ON feed.activity_id = activity.id
WHERE
feed.uid = _uid
AND feed.`status` = 'ACTIVE'
AND activity.`status` = 'ACTIVE'
AND activity.activity_type IN(_activityType)
AND activity.created BETWEEN startTime AND endTime
AND activity.source_id = _follow_to
ORDER BY
activity.created DESC
LIMIT
offset, limit;
END
答案 0 :(得分:0)
如果您的存储过程在文件中,那么您不需要``来保护列字段。那么您的参数名称必须完全匹配offset
与_offset
不匹配。
CREATE PROCEDURE `sp_ConsolidatedFollowFeedUserList`(
_uid INT,
_startTime INT,
_endTime INT,
_activityType VARCHAR(150),
_follow_to INT,
_offset INT,
_limit INT)
BEGIN
SELECT
feed.id AS feed_id,
activity.id AS activity_id,
activity.uid AS uid,
activity.source_id AS follow_to,
activity.activity_type,
activity.source_id,
activity.parent_id,
activity.parent_type,
activity.post_id
FROM
user_feed AS feed
JOIN user_activity activity ON feed.activity_id = activity.id
WHERE
feed.uid = _uid
AND feed.status = 'ACTIVE'
AND activity.status = 'ACTIVE'
AND activity.activity_type IN (_activityType)
AND activity.created BETWEEN _startTime AND _endTime
AND activity.source_id = _follow_to
ORDER BY activity.created DESC
LIMIT _offset, _limit;
END