Aug 23, 2020 1:07 pm
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
Sep 05, 2020 5:46 pm
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.
Sep 05, 2020 6:04 pm
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.