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
精彩评论