Bug #2672 Stored Procedure handler declaration causes syntax error
| Submitted: | 7 Feb 2004 17:55 | Modified: | 13 Feb 2004 12:32 |
|---|---|---|---|
| Reporter: | Peter Gulutzan | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.0-alpha-debug | OS: | Linux (SuSE 8.2) |
| Assigned to: | CPU Architecture: | Any |
[8 Feb 2004 12:28]
Peter Gulutzan
The error is in the documentation, not in the implementation. I have suggested a correction to the manual. So: the original example statement is "not a bug". However, there is still some DECLARE syntax that doesn't work. A corrected example: mysql> create procedure p1 () begin declare integrity_violation CONDITION FOR SQLSTATE '23000'; end;// Query OK, 0 rows affected (0.00 sec) mysql> create procedure p2 () begin declare integrity_violation CONDITION FOR SQLWARNING; end;// ERROR 1064 (42000): 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 'SQLWARNING; end' at line 1 The same happens for SQLEXCEPTION, NOT FOUND. Integers are okay.
[13 Feb 2004 12:32]
Peter Gulutzan
The whole complaint was really due to one page in the documentation. The documentation has now been fixed.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Using "DECLARE ... HANDLER FOR" inside a stored procedure causes a syntax error. This used to work. Now, even the example on the MYSQL Reference Manual "DECLARE Handlers" page http://www.mysql.com/doc/en/DECLARE_Handlers.html doesn't work. How to repeat: mysql> delimiter | mysql> CREATE PROCEDURE handlerdemo () -> -> BEGIN -> -> DECLARE CONTINUE HANDLER FOR '23000' SET @x2 = 1; -> -> set @x = 1; -> -> INSERT INTO test.t VALUES (1); -> -> set @x = 2; -> -> INSERT INTO test.t VALUES (1); -> -> SET @x = 3; -> -> END; -> -> | ERROR 1064 (42000): 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 '-> BEGIN -> DECLARE CONTINUE HANDLER FOR '23000' SET @x2 = 1; -> set' at line 1 ... Or, more simply: CREATE PROCEDURE PY () BEGIN DECLARE CONTINUE HANDLER FOR '23000' SET @x = 1; END//