What is a Stored Procedure? A stored procedure is a set of SQL statements stored on the server that takes in certain arguments and processes that code with those arguments at execution time. It can be invoked simply by making a call to the procedure with the correct arguments. The difference between stored procedures and other sets of SQL statements is that stored procedures reside on the server and are pre-compiled. Stored procedures are an integral part of the Oracle and MS SQL databases. MySQL has joined the bandwagon with its latest developer release. MySQL currently supports the SQL: 2003 syntax but will support T-SQL and Oracle PL/SQL syntaxes in the future. However, I should warn you that this release is still in the alpha stage and is not ready for prime time just yet. Even then, it helps to understand a little more about stored procedures since a mature release may be available in the not–so-distant future. Why should I care? You have been getting by just fine without any knowledge of stored procedures, thank you very much. But take a minute to understand how stored procedures in general could benefit you:
But?? Frans Bouma has done a great job of listing the cons associated with the usage of stored procedures, with great passion – I might add - and so instead of repeating it, I will let you read it at http://weblogs.asp.net/fbouma/archive/2003/11/18/38178.aspx. Using stored procedures is just one way to manipulate data. Good or bad – I leave it for you to decide. The scope of this tutorial is to have you creating stored procedures in MySQL in no time, should you want to. However, it is my opinion that there are times when the use of stored procedures is warranted for the reasons outlined above.
blog comments powered by Disqus |