Posted on November - 16 - 2011

Writing Stored Procedure & Functions in phpmyadmin

I found a lot of developers who failed to write stored procedure & functions in phpmyadmin.

When you see how to write stored procedures in mysql, there is a very important thing that you can easily miss: delimiter. Mysql SQL statements have “;” (semi-colon) as the default delimiter of its statements. Now a stored procedure/ function must be a valid mysql SQL statement to be executed.

Mysql use semi-colons (;) as delimiters for stored procedure/function statements, too! So what happens when you write one? Mysql may face a semi-colon before the SQL of the whole procedure ends. It’s very simple to resolve this issue. You can change mysql SQL statement’s delimiter. In phpmyadmin you can see text box on the left just under the textbox  with the label of “delimiter”. Whatever you write here before executing an SQL, mysql will use it as the delimiter for SQL statements! So just write “//” in that textbox, and GO!

« « Vouchersolution.com – an alternate way to pay online! |

Post a comment

*

Comment moderation is enabled. Your comment may take some time to appear.