0% found this document useful (0 votes)
52 views5 pages

Experiment:2: Steps For Experiment/practical

The document summarizes a PL/SQL program that calculates net salary for an employee. It declares variables for employee name, basic salary, deductions for DA, HRA, PF and calculates net salary. It then displays the output. It also creates a temporary table from an existing employee table, uses a cursor to loop through records with a certain department id, and updates salaries with a 15% or 10% increase based on the current salary.

Uploaded by

Neha panshotra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views5 pages

Experiment:2: Steps For Experiment/practical

The document summarizes a PL/SQL program that calculates net salary for an employee. It declares variables for employee name, basic salary, deductions for DA, HRA, PF and calculates net salary. It then displays the output. It also creates a temporary table from an existing employee table, uses a cursor to loop through records with a certain department id, and updates salaries with a 15% or 10% increase based on the current salary.

Uploaded by

Neha panshotra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment:2

Student Name:  Abinash puhan                                         UID: 20MCA1509

Branch:    mca                                                                     Section/Group:2B

Semester:    3rd                                                                   Date of Performance: 05/09/2021

Subject Name: PLSQL lab                                                  Subject Code: 21O-20CAP-715_20MCA-2_B

1) Task to be done:

WRITE A PROGRAM TO CALCULATE NET SALARY IF DA IS 30% OF BASIC,HRA IS


10% OF BASIC AND PF IS 7% IF BASIC SALARY IS LESS THAN 8000 ,PF IS 10% IF BASIC
SAL IS BETWEEN 8000 TO 160000

2) Steps for experiment/practical:

declare
    ename varchar2(15);
    basic number;
    da number;
    hra number;
    pf number;
    netsalary number;
begin
    ename:='Abinash’;
    basic:=10000;
    da:=basic * (30/100);
    hra:=basic * (10/100);
        if (basic < 8000)
    then
        pf:=basic * (8/100);
        elsif (basic >= 8000 and basic <= 16000)
    then
        pf:=basic * (10/100);
      
end if;
        netsalary:=basic + da + hra -pf;

dbms_output.put_line('Employee name : ' || ename);


dbms_output.put_line('Providend Fund : ' || pf);
dbms_output.put_line('Net salary : ' || netsalary);
end;
declare
    ename varchar2(15);
    basic number;
    da number;
    hra number;
    pf number;
    netsalary number;
begin
    ename:='Abinash';
    basic:=10000;
    da:=basic * (30/100);
    hra:=basic * (10/100);
        if (basic < 8000)
    then
        pf:=basic * (8/100);
        elsif (basic >= 8000 and basic <= 16000)
    then
        pf:=basic * (10/100);
             
end if;
        netsalary:=basic + da + hra -pf;
 
dbms_output.put_line('Employee name : ' || ename);
dbms_output.put_line('Providend Fund : ' || pf);
dbms_output.put_line('Net salary : ' || netsalary);
end;

DROP TABLE emp_temp;

CREATE TABLE emp_temp AS

SELECT employee_id,

first_name,

last_name,

department_id,

salary
FROM employees;

DECLARE

CURSOR employee_cur IS

SELECT employee_id,

salary

FROM emp_temp

WHERE department_id = 50

FOR UPDATE;

incr_sal NUMBER;

BEGIN

FOR employee_rec IN employee_cur LOOP

IF employee_rec.salary < 15000 THEN

incr_sal := .15;

ELSE

incr_sal := .10;

END IF;

UPDATE emp_temp

SET salary = salary + salary * incr_sal

WHERE CURRENT OF employee_cur;

END LOOP;

END;

/
4(b)

3) Output

SQL> /

PL/SQL procedure complete successfully

4) Learning outcomes (What I have learnt):

1.

2.
3.

Evaluation Grid:

Sr. No. Parameters Marks Obtained Maximum Marks


1. Demonstration and Performance 5
(Pre Lab Quiz)
2. Worksheet 10
3. Post Lab Quiz 5

You might also like