Modifed.
DROP FUNCTION IF EXISTS PersonName;
DELIMITER |;
CREATE FUNCTION PersonName( personID SMALLINT )
RETURNS CHAR(20)
BEGIN
DECLARE pname CHAR(20) DEFAULT '';
SELECT name INTO pname FROM family WHERE ID=personID;
RETURN pname;
END;
|
DELIMITER ;
whats wrong with this code? i get following error with it.
See Question&Answers more detail:osThere seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unknown Punctuation String @ 102 STR: |; SQL: DROP FUNCTION IF EXISTS PersonName;# MySQL returned an empty result set (i.e. zero rows).
DELIMITER |; DELIMITER |; DELIMITER |; DELIMITER |; DELIMITER |; DELIMITER |; DELIMITER |;
SQL query:
DELIMITER |;
MySQL said: Documentation #1064 - 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 'DELIMITER |' at line 1