TRY CATCH
Translation reference for TRY CATCH statement in Transact-SQL.
Description
Implements error handling for Transact SQL. A group of Transact-SQL statements can be enclosed in a TRY block. If an error occurs in the TRY block, control is usually passed to another group of statements that is enclosed in a CATCH block.
Sample Source Patterns
The following example details the transformation for TRY CATCH inside procedures.
Transact-SQL
CREATE PROCEDURE ERROR_HANDLING_PROC
AS
BEGIN
BEGIN TRY
-- Generate divide-by-zero error.
SELECT 1/0;
END TRY
BEGIN CATCH
-- Execute error retrieval routine.
SELECT 'error';
END CATCH;
END;|error |Snowflake SQL
Try catch outside routines (functions and procedures)
Transact-SQL
Snowflake Scripting
Known Issues
No issues were found.
Related EWIs
SSC-FDM-0020: Multiple result sets are returned in temporary tables.
Last updated
