This program declares variables to store employee name, number, department, and salary retrieved from the emp_L table. It opens a cursor to select these fields where the empno is 102. It then fetches the results into the declared variables, outputs them, and prints the number of employees found.
1 of 1
Download to read offline
More Related Content
Cv gxcfxvbcvb
1. declare
name emp_L.empname%type;
no emp_L.empno%type;
de emp_L.dept%type;
s emp_L.salary%type;
cursor c is select empname,empno,dept,salary from emp_L where empno=102;
begin
if not c%isopen then
open c;
end if;
loop
fetch c into name,no,de,s;
exit when not c%found;
dbms_output.put_line(name || ' ' || no || ' '|| s);
end loop;
dbms_output.put_line(c%rowcount || ' employee(s) found');
end;
/