It's SQL private work area.
It open's a area of memory where the query get passed and executed.
Implicit cursor
If your query with in a block returns exactly one row then it is call it as implicit.
No need to declare it. implicitly its declared by pl/sql engine
Explicit cursor
If your query returns more than one row then its call it as explicit cursor.
you need to declare it.
Cursor attribute
%FOUND
%NOTFOUND
%ISOPEN
%ROWCOUNT
DECLARE
cursor cursor_name
is
--your query with out INTO clause.
BEGIN
NULL;
END;
/
DECLARE
v_First_name Employees.First_name%TYPE;
v_salary Employees.salary%TYPE;
v_hire_date Employees.Hire_date%TYPE;
v_department_id Employees.department_id%TYPE;
CURSOR emp_data
IS
SELECT first_name, salary, hire_date, department_id
FROM employees
WHERE Department_id =90;
BEGIN
Dbms_output.put_line('-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*');
OPEN emp_data;
LOOP
FETCH emp_data INTO v_first_name, v_salary, v_hire_date, v_department_id;
EXIT WHEN emp_data%NOTFOUND;
Dbms_output.put_line('Name : '|| v_first_name);
Dbms_output.put_line('Salary : '|| v_salary);
Dbms_output.put_line('Hire Date : '|| v_hire_date);
Dbms_output.put_line('Dept id : '|| v_department_id);
Dbms_output.put_line('-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*');
END LOOP;
CLOSE emp_data;
END;
/