Modifed.
DROP FUNCTION IF EXISTS PersonName; DELIMITER |; CREATE FUNCTION PersonName( personID SMALLINT ) RETURNS CHAR(20) BEGIN DECLARE pname CHAR
You have to add delimiter $$ in the beginning and in the last of the mysql script you should to end by the delimiter
delimiter $$
delimiter