Bug #15273 | Errors and inconsistencies in SP syntax description | ||
---|---|---|---|
Submitted: | 27 Nov 2005 15:12 | Modified: | 29 Nov 2005 18:43 |
Reporter: | Roland Bouman | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | 5.0.15 | OS: | NA |
Assigned to: | CPU Architecture: | Any |
[27 Nov 2005 15:12]
Roland Bouman
[27 Nov 2005 15:32]
Valeriy Kravchuk
Thank you for a problem report. I already asked our documentation team about the clarification of what statements are allowed inside SP and more formal description of that. I hope, this your request will become yet another notification on what should be done. What you are mistaken about is BEGIN ... END part. Our documentation correctly describes current situation in MySQL: mysql> create procedure pp1 () begin end; Query OK, 0 rows affected (0.00 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.0.17 | +-----------+ 1 row in set (0.00 sec) So, BEGIN .. END may contain no statements inside. I am not sure it is a proper behaviour (Oracle does not allow this, for example), but it is properly documented.
[27 Nov 2005 16:54]
Roland Bouman
Thanks Valeriy for your quick reaction. I did recall trying an empty begin end and failing with a syntax error, so I assumed it was down to that. However, I just tried a couple of empty begin..ends, in different contexts, and they all seem to work. So, thanks for clearing that up. An empty begin end is actually very handy for CASE..END CASE statements. Sometimes you need to do something in a particular case, and nothing in another. Because you must catch every case (else, a runtime error 1339 willl result), a NOOP statement can be very handy (an empty ELSE or WHEN is not allowed, right?). So, thank you again.
[29 Nov 2005 17:49]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant product(s). Additional info: I've updated the stored procedures chapter. CREATE PROCEDURE section: change statement or statements to be statement. HANDLER section: change sp_statement to statement. I've also pointed out that statement can be a simple statement or a compound statement. No change needed for BEGIN/END - it can indeed be empty.
[29 Nov 2005 18:43]
Roland Bouman
Cheers Paul, thank alot!