Query: Write a PLSQL block using the cursor to print the name salary of all employees working in the Sales department
In this blog, we will see PLSQL Block using the cursor to print the name salary of all employees working in the sales department.

Consider the employee table has the following columns based on that we will write a PLSQL block to print all the employees working in the sales department.
- Employee Number
- Employee Name
- Salary
- Department Number
PLSQL Block to capture employees working in all the department
declare
cursor C_Employee is
select Employee_Name,
Salary,
Department_Number
from
Employee;
v_First_Name Employee.Employee_Name%type;
v_Salary Employee.Salary%type;
v_Department_Number Employee.Department_Number%type;
begin
open C_Employeeloyee;
loop
fetch C_Employee into
v_First_Name,
v_Salary,
v_Department_Number;
exit
when C_Employee%NOTFOUND;
dbms_output.put_line
(v_First_Name||' '||v_Salary||' '||v_Department_Number);
end loop;
close C_Employee;
end;
/PLSQL Block to capture all employees working in the sales department
declare
cursor C_Employee is
select Employee_Name,
Salary,
Department_Number
from
Employee
where
Department_Number=30;
v_First_Name Employee.Employee_Name%type;
v_Salary Employee.Salary%type;
v_Department_Number Employee.Department_Number%type;
begin
open C_Employeeloyee;
loop
fetch C_Employee into v_First_Name,
v_Salary,
v_Department_Number;
exit when C_Employee%NOTFOUND;
dbms_output.put_line
(v_First_Name||' '||v_Salary||' '||v_Department_Number);
end loop;
close C_Employee;
end;
/Conclusion
In this article, we have seen two examples for PL/SQL block using the cursor to print all employees working in the Sales department.