开发者

Accessing row data from MySQL Stored Function

Given a table with columns like title, firstname and lastname. In MySQL I've created this stored function named fullnam开发者_运维知识库e() which CONCATs given columns and returns it.

My idea was that I would just execute this SQL statement and I would have the fullname: SELECT *, fullname() FROM people;

It doesn't work. Does anyone know why? I'm pretty new to Stored Functions.

CREATE FUNCTION `fullname`()
    RETURNS VARCHAR(255)
    LANGUAGE SQL
    NOT DETERMINISTIC
    READS SQL DATA
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN
    RETURN(CONCAT(title, " ", firstname, " ", lastname));
END
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜