The DB2 Stored Procedure these are Steps to follow
The below are the steps in writing sample procedure in SQL.
CREATE PROCEDURE update_sal (IN empnum CHAR(6),
INOUT rating SMALLINT)
LANGUAGE SQL
BEGIN
IF rating = 1 THEN
UPDATE employee
SET salary = salary * 1.10,
bonus = 1000
WHERE empno = empnum;
ELSEIF rating = 2 THEN
UPDATE employee
SET salary = salary * 1.05,
bonus = 500
WHERE empno = empnum;
ELSE
UPDATE employee
SET salary = salary * 1.03,
bonus = 0
WHERE empno = empnum;
END IF;
END;
Comments
Post a Comment