6

I try to add this function using the following SQL in phpmyadmin/MySQL

DROP FUNCTION IF EXISTS `__myv`;
DELIMITER ;;
CREATE   FUNCTION `__myv`(`a` int, `b` int) RETURNS bigint(20)
BEGIN

    return FLOOR(a / b);
END;;
DELIMITER ;

but I get this error:

Error

SQL query:

DELIMITER;

MySQL said: Documentation
#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 'DELIMITER' at line 1 

How to fix this error??

Alex.DX
  • 141
  • 1
  • 4
  • 14

2 Answers2

6

DELIMITER is a Mysql console command, You can't use it in phpmyadmin. To set the delimiter in phpmyadmin, see this other answer

Community
  • 1
  • 1
Filipe Silva
  • 21,189
  • 5
  • 53
  • 68
1

Even if DELIMITER is a console command, phpMyAdmin's import module has accepted it since many years. When opening a database and clicking on SQL, a query entered there is passed to the import module, so it should work (unless you have a very old phpMyAdmin version).

Marc Delisle
  • 8,879
  • 3
  • 29
  • 29