Forum

How to Write a PL/S...
 
Share:
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


Posts: 17
Topic starter
(@rahul)
Active Member
Joined: 4 years 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
Posts: 53
 VK
Guest
(@VK)
Trusted Member
Joined: 4 years 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

Self Learning Video Tutorials - Software Course

Posts: 27
Admin
(@vinodkrsetty)
Eminent Member
Joined: 5 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

Leave a reply

Author Name

Author Email

Title *

Preview 0 Revisions Saved
Share: