views:

182

answers:

2

Having trouble getting this to apply in MySQL Workbench 5.2.15

DELIMITER //

CREATE 
    DEFINER=`potts`@`%` 
    FUNCTION 
        `potts`.`fn_create_category_test`  (test_arg VARCHAR(50))
    RETURNS int

BEGIN

    DECLARE new_id int;
    SET new_id = 8;
    RETURN new_id;

END//

The actual function will have a lot more between BEGIN and END but as it stands, even this 3 liner won't work.

Thanks!

+1  A: 

DELIMITER $$

CREATE FUNCTION `fn_create_category_test` (test_arg varchar(50))
   RETURNS INT
BEGIN

DECLARE new_id int;
set new_id=8;
return new_id;
END $$

DELIMITER ;

Works fine for me, try getting rid of DEFINER?

MindStalker
A: 

Hey,

I get a similar problem.. check my post here http://stackoverflow.com/questions/2549929/mysql-stored-function-create-function-function-definition-problem-using-forma

There's nothing wrong with the function... I think its a bug in mysql.

mysql version 5.0.90-community-log

jason