33
SQL - Stored Procedure 📦
SQL is the standard language for the Relational Database, for storing, manipulating and retrieving stored data. For basics of SQL (link)
A Stored Procedure is a SQL code that we can save, so the code can be reused again and again.
So, if we have any SQL query which we write over and over again, we can use it as a stored procedure so that we can just call it to execute it.
To add Parameters in the procedure, first, we need to alter the procedure for which we can use ALTER procedure statement as follows:
To Execute the above stored procedure, we have to declare a variable for output parameter and specify the parameter as out
Just like this, we can also set multiple parameters by separating each parameter and the data type with a comma
To drop a stored procedure, use the DROP statement as follows:
DROP PROCEDURE usp_proc;
Thank you!! Feel free to comment on any type of feedback or error you have 😄✌
33