-->

02 October 2020

PL/SQL Cursor Attribute

  Asp.Net CS By Example       02 October 2020
 PL/SQL Cursor Attribute 
     There are 2 type of Cursor and they both have attribute for handling is cursor opened, is data found ,to get how many row return or no data found conndition.

 Explicit Cursor attribute :-  
Sr.No Attribute Description
1) c1%isopen This is used for checking used cursor opend or not.
2) c1%found This is used for checking cursor has more data or not.
3) c1%notfound This is used for handling cursor no data found condition.
4) c1%rowcount This is used for getting total row count of cursor data have.


 Implicit Cursor attribute :-  
Sr.No Attribute Description
1) sql%isopen This is used for checking used cursor opend or not.
2) sql%found This is used for checking cursor has more data or not.
3) sql%notfound This is used for handling cursor no data found condition.
4) sql%rowcount This is used for getting total row count of cursor data have.



 Examples of cursors with cursor attribute :-  
 declare
     cursor cur_emp is select  emp_sal  from  emp;
     l_emp_sal emp.emp_sal%type;
 begin
        open cur_emp;
        loop
        fetch cur_emp into l_emp_sal;
            exit when cur_emp%notfound;
            dbms_output.put_line( l_emp_sal);
        end loop; ; 
        dbms_output.put_line('Processed records:-'||cur_emp%rowcount); 
        close cur_emp;
 end;     
logoblog

Thanks for reading PL/SQL Cursor Attribute

Previous
« Prev Post

No comments:

Post a Comment

Please do not enter any spam link in the comment box.