Modifed.
DROP FUNCTION IF EXISTS PersonName; DELIMITER |; CREATE FUNCTION PersonName( personID SMALLINT ) RETURNS CHAR(20) BEGIN DECLARE pname CHAR
In your last line where you're restoring the delimiter to semicolon you need a space between DELIMITER and ; i.e.
DELIMITER
;
DELIMITER ;