CLOSE the cursor in the Execution Section before you end the PL/SQL Block.
Syntax:
DECLARE
variables;
records;
create a cursor;
BEGIN
OPEN cursor;
FETCH cursor;
process the records;
CLOSE cursor;
END;
Example:
declare
abc tb1%rowtype;
cursor c_cur is select * from tb1 where age>25;
begin
open c_cur;
loop
fetch c_cur into abc;
dbms_output.put_line('the senoirs peoples are'||abc.id);
dbms_output.put_line('the senoirs peoples are'||abc.name);
dbms_output.put_line('the senoirs peoples are'||abc.age);
dbms_output.put_line('the senoirs peoples are'||abc.salary);
dbms_output.put_line('the senoirs peoples are'||abc.gender);
exit when c_cur%notfound;
end loop;
close c_cur;
end;
No comments:
Post a Comment