[Solved] MYSQL DELIMITER always reports an error

DELIMITER$
 CREATE FUNCTION add_float(value1 FLOAT,value2 FLOAT)
 RETURNS FLOAT
 BEGIN
 DECLARE SUM_f FLOAT;
 SET SUM_f=value1 + value2;
 RETURN SUM_f;
 END $
 DELIMITER ;

A simple piece of code that adds two numbers and gives you an error message

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

The biggest problem is that DELIMITER is not aligned. Be sure to align before and after using DELIMITER. In addition, in some visualization tools, such as SQLyog, the status of the front and rear is displayed.

Executing the code will still have the above error. The reason is the display problem, it doesn’t really align. you selected this section

When you see the cursor, you will find that the left side is not consistent. After aligning it, the program can be executed correctly.

The article knowledge points match the official knowledge files, and you can further learn the relevant knowledge Java skill tree Use JDBC to operate the databaseDatabase operation 43222 people are learning the system