Try/catch syntax

时光毁灭记忆、已成空白 提交于 2019-12-11 07:58:28

问题


How can I not get the right syntax for a simple try/catch? Do I have to do anything more?

All I get is error 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 

Thanks


回答1:


MySQL doesn't have TRY/CATCH functionality. You can use handlers.



来源:https://stackoverflow.com/questions/47134924/try-catch-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!