Mysql: DELIMITER syntax error on line 1

I am trying 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?

+6
source share
2 answers

Even if DELIMITER is a console command, the phpMyAdmin import module has been accepting it since many years. When you open the database and click on SQL, the query entered there is passed to the import module, so it should work (unless you have a very old version of phpMyAdmin).

+1
source

DELIMITER is a Mysql console command, you cannot use it in phpmyadmin. To set the delimiter in phpmyadmin see this other answer

+6
source

Source: https://habr.com/ru/post/959120/


All Articles