Procedure Creation

I am at a loss, I see no reason that is as simple as this will not work:

CREATE PROCEDURE test()
BEGIN
    DECLARE var INT;
    SET var = 0;
END

I am literally just checking this because I cannot create anything at all. The error message I get is:

[ERROR in query 1] You have an error in the SQL syntax; check the manual that matches your version of MySQL server for the correct syntax to use next to '' on line 3

Line 3 is the DECLARE statement. Any ideas?

+5
source share
1 answer

SQL. - ;, , MySQL ; 3, . DELIMITER - DELIMITER.

-- Change DELIMITER TO // instead of ;
DELIMITER //

CREATE PROCEDURE test()
BEGIN
    DECLARE var INT;
    SET var = 0;
END
//
-- Mark the stored procedure as one statement

DELIMITER ;
-- Change delimiter back to ;
+11

All Articles