MySQL Stored Procedure Example - Batch Salary Increment
Open your MySQL Query Editor then copy & paste the below code to make a Stored Procedure which will take Increment percentage as parameter and Increment Salary of all employees in MySQL:
delimiter |
CREATE PROCEDURE SP_SALARY_INCREMENT(P_Percentage DOUBLE)
BEGIN
UPDATE employees
SET Salary=Salary+(Salary*P_Percentage/100);
END;
|
MySQL Stored Procedure Example - Batch Salary Increment - MySQL Query Editor Output
Again open your MySQL Query Editor then copy & paste the below code to execute the Stored Procedure & get the desired result:
call SP_SALARY_INCREMENT(10.5);
MySQL Stored Procedure Example - Executing Stored Procedure - MySQL Query Editor Output
Related Tutorial Examples
- MySQL Stored Procedure: Variable Example
- MySQL Stored Procedure: CREATE TABLE SELECT... Example
- MySQL Stored Procedure Function: How to Drop a Function Example
- MySQL Stored Procedure Function: How to Drop a Stored Procedure Example
- MySQL Stored Procedure Function: Making hello world Function using aliase Example
- MySQL NULLIF() Nested Function Example
- MySQL NULLIF() Function Datetime Value Example
- MySQL NULLIF() Function String Value Example
- Parentheses in SQL Command MySQL Example
- 20 steps to make CakePHP Blog Project


No comments:
Post a Comment
leave your comments here..