尝试/捕捉语法

时间:2017-11-06 10:37:17

标签: mysql sql syntax try-catch mysql-error-1064

如何才能为简单的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 

由于

1 个答案:

答案 0 :(得分:1)

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