Hudzilla.org - the homepage of Paul Hudson
Contents > Databases > Introduction Wish List | Report Bug | About Me ]

9.1.5     Stored procedures

This is NOT the latest copy of this book; click here for the latest version.

If you find yourself performing the same queries again and again, it might help to use stored procedures. These are like named functions within a DBMS - you define a sequence of instructions to perform, and give it a name. Whenever you want that same set of instructions to be performed, you simply run the procedure - the results often come back faster because the DBMS has already prepared the query in advance, and so knows how to run it quickly.

One big advantage to stored procedures is that they remain on the DBMS - if you want to change a procedure so that it does something different, you need only change it once, on the server, to have all the programming code that calls it updated also.

Stored procedures are not supported in all DBMSs. Specifically, MySQL 4 does not support them, although they are slated for release in MySQL 5.





<< 9.1.4 Transactions   9.1.6 Triggers >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
ajekigbe - 06 Sep 2008

TO:- Mrman,

If something is slated, it has been planned or intended to happen at a particular time or in a particular way. So, "slated for release in mySQL 5" means scheduled for release in mySQL 5, i.e. it will be included in mySQL 5.

I think Hudson (The Author) communicates with "slated" than "stated".

Esteemed regards.

Mrman - 06 Sep 2008

slated for release in MySQL 5.

Do you mean stated?



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is two plus five?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow