Forum

How to Write a PL/S...
 
Notifications
Clear all

How to Write a PL/SQL Package with Procedure in it. Procedure will take designation and incentive as input and update the employee salary by adding the incentive for the given designation. Display the number of employee records that have got updated


Rahul Updhyay
Posts: 17
Topic starter
(@rahul)
Active Member
Joined: 1 year ago

How to Write a PL/SQL Package with Procedure in it. Procedure will take designation and incentive as input and update the employee salary by adding the incentive for the given designation. Display the number of employee records that have got updated...

Create a PL/SQL Package with Procedure in it.  

2 Replies
VK
Posts: 15
 VK
(@VK)
Joined: 1 year ago
CREATE OR REPLACE PACKAGE EMP_Designation AS
PROCEDURE EMP_Details
(
psr_design Employee.Designation%TYPE
, psr_Incentive NUMBER
);
END emp_designation;
/

CREATE OR REPLACE PACKAGE BODY EMP_Designation AS
PROCEDURE EMP_Details
(
psr_design employee.designation%TYPE
, psr_Incentive NUMBER
)
IS
BEGIN
UPDATE employee SET Employee.Salary = Employee.Salary + psr_Incentive
WHERE Designation = psr_design;
dbms_output.put_line(SQL%ROWCOUNT || ' employee(s) are updated');
END EMP_Details;
END;
/

Try this and let me know. Any other approach is welcome. 

Reply
KV Kumar
Posts: 27
Admin
(@vinodkrsetty)
Member
Joined: 2 years ago

Create a PL/SQL Trigger to display the message "Re-Order Level reached for the item-item name", whenever an item quantity reaches 10 and below while updating for inserting an item.

For this, we can write a below query. 

CREATE TRIGGER QuantityAlert
ON ItemTable
AFTER UPDATE
AS
BEGIN
INSERT INTO AlertItemTable
SELECT ProductID, ProductName, 'Low Stock',
'Re-Order Level Reached For the Item' + ProductName + ' left'
FROM inserted
WHERE Quantity = 10
END
GO

Let me know In case of any queries. 

Reply
Share: