The below code works correctly when I use command line (mysql.exe) to execute, but incorrect when I use SQL Query in phpmyadmin or using ScriptRunner (Java) to execute.
The error: Error Syntax execute DELIMITER $$
How can I solve this problem?
-- Procedures
--
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `upload_photo`(
IN owner_id int, IN photo_name text, IN photo_url text, IN thumbnail text
)
begin
declare inserted_id int unsigned default 0;
INSERT INTO photo(`owner_id`, `photo_name`, `photo_url`, `thumbnail`) VALUES(owner_id, photo_name, photo_url, thumbnail);
set inserted_id = last_insert_id();
select * from photo where photo_id = inserted_id;
end$$
--
DELIMITER ;