Please help me finding where I have made mistake?
delimiter //
CREATE FUNCTION `count_photos_in_gallery`(`tmp_gallery_id` INT(11) NOT NULL) RETURNS TINYINT(3) UNSIGNED
BEGIN
DECLARE `tmp_count` TINYINT(3) UNSIGNED DEFAULT 0;
SELECT COUNT(`id`) INTO `tmp_count` FROM `photos_items` WHERE `gallery_id`=`tmp_gallery_id` LIMIT 1;
RETURN `tmp_count`;
END//
Error:
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 ‘NOT NULL) RETURNS TINYINT(3) UNSIGNED BEGIN DECLAREtmp_count
TINYINT(3) UNSI’ at line 1
Change function declaration, parameters cannot have NOT NULL option –