Lab Cycle 4
Lab Cycle 4
2022 – 2023)
Lab Cycle – 4
3. Write a PL/SQL block that computes increment of an employee
in employee table by using incr function which takes employee
number as argument, calculates increment and returns the
same based on the following criteria:
If salary <= 3000 then increment = 30% of salary
If salary > 3000 and <= 6000 then increment = 20% of salary
Else increment = 10% of salary.
PROGRAM 3:
declare
n number:=&no;
s number;
begin
s:=incr(n);
dbms_output.put_line('incr salary'||s);
update emp2 set sal=sal+s where empno=n;
end;
declare
n number:=&no;
r emp2%rowtype;
begin
raisesal(n);
select * into r from emp2 where empno = n;
dbms_output.put_line(r.empno||’ ‘||r.sal);
end;
5.
6.
7.
8. Consider the following tables
PERSINFO
EMPNO NAME AGE
AUDITPERSINFO
AG
EMPNO NAME OPERATION ODATE
E
PROGRAM 6: