Try/catch 语法

Try/catch syntax

如何获得简单 try/catch 的正确语法? 我还需要做些什么吗?

我得到的只是错误 1064...

BEGIN TRY
SELECT * FROM NonExistentTable;
END TRY

BEGIN CATCH
SELECT * FROM ExistingTable;
END CATCH;
GO

#1064 - 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 'TRY
SELECT * FROM NonExistentTable' at line 1 

谢谢

MySQL 没有 TRY/CATCH 功能。您可以使用 handlers.