We can use these user defined functions to return some values by computing the data in the database. but we cannot change the database using any stored function.
These functions must return a value,only have input parameters,should be compiled and executed each time when we want to call the function and can use inside the stored procedures as well.
We’ll look at the format of a Stored Function.
So guys welcome to my SQL Stored Procedures small tutorial and i hope you’ll grab all what you want 🙂
So first we’ll see what is a Stored Procedure
Basically we write the same sql query in our system,programme in many places.The same code.Why we can’t use a template or something?? Yes that’s why we use STORED PROCEDURES 😛
Any more advantages??
- You don’t need to compile it again and again.Just recompile it once you modified the procedure.
- Performance improvement by executing the procedure on server.
- Can provide security since user can execute stored procedure rather accessing tables.
- If only the business logic changes then only change the stored procedure.