What are the cursor attributes used in PL/SQL ?

 %ISOPEN  - to check whether cursor is open or not   % ROWCOUNT - number of rows fetched/updated/deleted.   %  FOUND - to check whether cursor has fetched any row. True if rows are fetched.     % NOT FOUND - to check whether cursor has fetched any row. True if no rows are featched.These  attributes are proceeded with SQL for Implicit Cursors and with Cursor name for Explicit Cursors.

Showing Answers 1 - 12 of 12 Answers

pa

  • Sep 15th, 2005
 

  Was this answer useful?  Yes

Paramjeet singh

  • Sep 15th, 2005
 

Atrributes of Coursors are %Rowcount,%IsOpen,%NotFound,%Found

  Was this answer useful?  Yes

Jayakumar M

  • Dec 6th, 2005
 

For Implicit Cursors:-

%Found - Returns TRUE,If the last DML Statement affect atleast 1 row otherwise FALSE.

%NotFound - Returns TRUE If last DML Statement doesn't affect atleast 1 row otherwise FALSE.

%Rowcount - Returns number of rows affected by the last DML statement.

%Isopen - Returns TRUE if the cursor is open otherwise FALSE. Its always returns FALSE incase of implicit cursor. Because after executing the DML statement Oracle Server automatically close the cursor.

For Explicit Cursors:-

%Found - Returns TRUE if the Last fetch returns a Row otherwise FALSE.

%NotFound - Returns TRUE if the last fetch doesn't return any row otherwise FALSE.

%Rowcount - Returns number of rows returned so far from the active set.

%Isopen - Returns TRUE if the cursor is open otherwise FALSE.

%FOUND  :-  Returns True if successful fecth has been executed.
                       Returns false if no rows returned
                       Returns NULL if cursor is opened but fetch is not executed.
                      Raises  INVALID_CURSOR exception if cursor is not opened or closed.
%NOTFOUND :- Returns true if no rows were returned
                             Returns false if fectch has been executed successfully.
                            Returns  NULL if cursor is open but fetch is not executed
                          Raises INVALID_CURSOR Exception If the cursor is not opened or cursor is closed
%ISOPEN  :- Returns true if the cursor is open
                      Returns false if the cursor is closed
  
%ROWCOUNT :- Returns no of records fetched.
                               Raises INVALID_CURSOR exception if the cursor is not opened or closed.
 
     

samareshp

  • Jul 30th, 2009
 

There are five cursor attributes: %isopen, %found, %notfound, %rowcount and %bulk_rowcount.

%isopen
With %isopen it is possible to test whether a cursor was opened:
%found
%found returns true when the last fetch operation on the cursor fetched a row. If %found is used on a cursor that is not open (%open returns false), an ORA-01001: invalid cursor is raised. %notfound returns null is returned:
%notfound
%notfound returns true when the last fetch operation on the cursor did not fetch a row. If %notfound is used on a cursor that is not open (%open returns false), an ORA-01001: invalid cursor is raised. %notfound returns null is returned:
%rowcount
%rowcount returns the number of rows that have been fetched so far. So, it increases with each fetch:
%bulk_rowcount
%bulk_rowcount is similar to %rowcount, but is used in bulk collects.

  Was this answer useful?  Yes

Lakshmi84

  • Jul 31st, 2009
 

%ISOPEN - To check whether cursor is open or not.Returns true if cursor or cursor variable is open or not otherwise false.

%FOUND - To check wheteher cursor is found or not. Returns true if fetch returns a row otherwise false.

%NOTFOUND - To check whether cursor is not found or not.This works logically opposite to %FOUND. This is usec to exit a loop when fetch fails to return a row.

%ROWCOUNT - To check the number of rows fetched by the cursor.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions