문제

I'm trying to do a DROP CREATE stored procedure in MySQL.

The first block of code runs just fine.

DELIMITER //
-- IMPORTANT: Change to ecom_prod
USE ecom_dev;


DROP PROCEDURE IF EXISTS `usp_getDetails`;

The second block gives an error in statement #2 near --DROP CREATE Procedure DROP PROCEDURE IF EXISTS usp_getDetails; at line 1

DELIMITER //
-- IMPORTANT: Change to ecom_prod
USE ecom_dev;

-- DROP CREATE Procedure
DROP PROCEDURE IF EXISTS `usp_getDetails`;

The only difference is the addition of extra comments. I can't understand how the extra comment is causing this error.

Any and all help is welcome

도움이 되었습니까?

해결책

Once the DELIMITER is changed to something other than semicolon, the new delimiter should be used in place of the semicolon.

For example:

DELIMITER $$

-- IMPORTANT: Change to ecom_prod
USE ecom_dev$$

DROP PROCEDURE IF EXISTS `usp_getDetails`$$

DELIMITER ;

I'm not sure how your code is working with the semicolons. I don't think the issue has anything to do with the comments. But I haven't tested it. I always have a blank line preceding and following DELIMITER. And the only time I ever use DELIMITER is when I'm issuing a CREATE <stored_program_type>.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top