plsql - pl/sql procedure with savepoint -


i have table employee columns: id, name, department, salary. want create procedure increase salary employees in specific department , run procedure if salary less 500, otherwise return savepoint. don't know how write exception

create procedure `procedure1` (in dep1 int(11), in sal1 int(11)) begin    savepoint point1;    update employee set salary=salary+sal1    department=dep1;    exception      when salary>500    rollback point1;  end 

maybe need review point of view, because can add clause in order update salaries less or equal 500, e.g.:

   update employee set salary=salary+sal1    department=dep1      , salary <= 500; 

with think don't need savepoint, find here how use it: savepoint

hope help!!.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -