开发者

MySQL CReate Function Syntax Error

I'm trying to create function using phpmyadmin/mysql console. Without any luck. I'm getting info of syntax error.

Can anybody take a look on this function?

CREATE FUNCTION fnCategoryList
(
    @NewsID INT
)
RETURNS VARCHAR(1000)
AS
BEGIN
    DECLARE @CategoryList VARCHAR(1000)
    SET @CategoryList = ''

    SELECT @CategoryList = COALESCE(@CategoryList + ',','') + C.[Name]
        FROM news_开发者_C百科categories AS NC
            INNER JOIN categories AS C
                ON NC.CategoryID = C.ID
        WHERE NC.NewsID = @NewsID

    RETURN @CategoryList
END


This is not correct syntax for a MySQL function. That's why you get a syntax error.

http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

Did you try to copy this from a different RDBMS?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜