5
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.
我認為問題是GO是批量終止符,而不是語句終止符。顯式設置事務后,我得到了這段代碼,而沒有告訴我程序已經存在。如果沒有事務語句,我會收到程序已經存在的錯誤。
start transaction; drop procedure if exists usp_test; commit; start transaction; CREATE PROCEDURE usp_test() SELECT * from books; commit; call usp_test();
開始交易; drop procedure如果存在usp_test;承諾;開始交易;從書中創建程序usp_test()SELECT *;承諾;叫usp_test();