What is the equivalent of 'go' in MySQL?
The semicolon is the default delimiter.You can however redefine it to whatever you want with the DELIMITER keyword. From the MySQL manual:
mysql> delimiter //mysql> CREATE PROCEDURE simpleproc (OUT param1 INT) -> BEGIN -> SELECT COUNT(*) INTO param1 FROM t; -> END; -> //Query OK, 0 rows affected (0.00 sec)mysql> delimiter ;mysql> CALL simpleproc(@a);Query OK, 0 rows affected (0.00 sec)
This is not limited to stored procedure definitions of course.
I think the problem is that GO is a batch terminator, not a statement terminator. After explicitly setting transactions, I got this code to execute without telling me that the procedure already exists. Without the transaction statements, I do get an error that the procedure already exists.
start transaction; drop procedure if exists usp_test;commit;start transaction; CREATE PROCEDURE usp_test() SELECT * from books;commit;call usp_test();