Skip to toolbar

Forum

Create a PL/SQL Fun...
 
Notifications
Clear all

Create a PL/SQL Function to calculate increment for the employees. Function will take increment percentage and salary as input and return increment amount as output.  


Rahul Updhyay
Posts: 17
(@rahul)
Active Member
Joined: 4 months ago

Create a PL/SQL Function to calculate increment for the employees. 

1 Reply
John
Posts: 13
 John
Guest
(@John)
Joined: 4 months ago

You can achieve this using simple SQL update statment.

Let us consider a table called employee. Here I got four rows.

IDE Name_NM Salary_SA

1 Nayani 1000
2 Kapil 1000
3 Sundhar 10000
4 Devis 20000

I want to increase the salary of employee by 10 percent. For this I can wrire a query as below

UPDATE Employee SET Salary= (Select Salary+ (Select Salary*0.1))

This will increase all employee salary by 10 percent.

IDE           Name_NM               Salary_SA

1              Nayani               1100
2              Kapil                   1100
3              Sundhar          11000
4              Devis                22000

 

For suppose I want to increase a particular employee salary by 20 percent I can write a query as

UPDATE Employee SET Salary= (Select Salary+ (Select Salary*0.1)) Where ID = 2

 

 

Reply

Leave a reply

Author Name

Author Email

Title *

Maximum allowed file size is 10MB

 
Preview 0 Revisions Saved
Share: