title: Exception using TRY CATCH in mysql stored procedure
body: <p>Following is the procedure in which i am trying to catch the exception, if there is any in stored procedure</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS test;
  
  DELIMITER //
  
  CREATE PROCEDURE test( IN contextFilter TEXT)
     BEGIN TRY
  
  
    set  @sub_query = 'SELECT id from test_table';
  
     PREPARE stmt_query FROM @sub_query;
        SELECT @sub_query;
                  EXECUTE stmt_query;
                  DEALLOCATE PREPARE stmt_query;
  
     END TRY //
     BEGIN CATCH
      SELECT ERROR_NUMBER() AS ErrorNumber,ERROR_MESSAGE() AS ErrorMessage;
    END CATCH
  
   DELIMITER ;
  </code></pre>
  
  <p>When i try to source the stored procedure , i am getting the following exception</p>
  
  <pre><code>source /home/test.sql;
  Query OK, 0 rows affected (0.01 sec)
  
  ERROR 1064 (42000) at line 5 in file: '/home/test.sql': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'set  @sub_query = 'SELECT id from test_table';
  
     PREPARE stmt_query FROM @' at line 5
  ERROR 1064 (42000) at line 17 in file: '/home/test.sql': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CATCH
      SELECT ERROR_NUMBER() AS ErrorNumber,ERROR_MESSAGE() AS ErrorMessage;
  ' at line 1
  </code></pre>