Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yuniql fails on a MariaDB procedure definition that contains a nested BEGIN END block #308

Open
svegasoft opened this issue Oct 4, 2023 · 2 comments

Comments

@svegasoft
Copy link

The error message:

... has failed while attempting to execute script file filename.sql due to error "(0x80004005) Error 0: Fatal error encountered during command execution."

SQL script:

drop procedure if exists test;

CREATE PROCEDURE test()
BEGIN

   DECLARE EXIT HANDLER FOR SQLEXCEPTION
   BEGIN
      SET @error = 'In SQLEXCEPTION handler';
   END;
END

I turned on general_log in MariaDB and examining the log could see that this script wasn't sent to the server indicating that the failure occured in yuniql.

@sselvia
Copy link

sselvia commented Oct 5, 2023

MariaDB should work the same as MySQL - Yuniql does not support the delimiter value that you set in MySQL Workbench. We found placing the entire procedure or trigger block on one line, yunql worked. You have an extra begin end block that we don't have.

CREATE PROCEDURE test() BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SET @error = 'In SQLEXCEPTION handler'; END; END;

@svegasoft
Copy link
Author

This is not setting a delimiter, DECLARE EXIT HANDLER FOR SQLEXCEPTION is a compound statement supported by MySql with its own BEGIN END and it can be nested inside a stored procedure. Here is a MySql doc reference: https://dev.mysql.com/doc/refman/8.0/en/declare-handler.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants