For instance, if I write:
select employee_id,last_name from employees;
I will get all the rows existing in "EMPLOYEES" table. If I write:
declare
id employee_id.employees%type;
ln last_name.employees%type;
begin
select employee_id,last_name into id,ln
from employees
where employee_id = 100;
dbms_output.put_line(id||' '||ln);
end;
I get -
100 King
If I want to retrieve multiple rows, then I will use CURSOR. But these multiple rows can be retrieved using simple SQL statement I mentioned previously. Then, what's the use of using PL/SQL Declare..Begin..End statement ?