Problem with user defined function
CREATE FUNCT开发者_如何转开发ION testing(id INT, dsc TEXT) RETURNS TEXT
BEGIN
DECLARE ntxt TEXT;
SET ntxt = dsc;
RETURNS ntxt;
END;
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 'TEXT' at line 3
What i miss here ?
- You forgot to change the delimiter
RETURN
has an extraS
This does work:
DELIMITER //
CREATE FUNCTION testing(id INT, dsc TEXT) RETURNS TEXT
BEGIN
DECLARE ntxt TEXT;
SET ntxt = dsc;
RETURN ntxt;
END//
You probably forgot to add DELIMITER $$
in the very beginning of your script (Standard delimiter is ;
, and it's also used in procedures/functions). For example,
DELIMITER $$
[CREATE FUNCTION ...... ]
$$
DELIMITER ;
精彩评论