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

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -