• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql
You are here: Home / Oracle / plsql / Attributes of CURSOR in Oracle PLSQL

Attributes of CURSOR in Oracle PLSQL

December 1, 2012 by techhoneyadmin

The attributes of cursor in Oracle PLSQL helps us to determine the state or status of a cursor.

Below is the list of attributes of cursors that we can use in Oracle PLSQL to determine the status of cursor.

Attribute Explanation
%ISOPEN If the cursor is open the %ISOPEN returns TRUE, else returns FALSE.
%FOUND Returns INVALID_CURSOR if the cursor is declared but has been closed or not opened.

Returns NULL if no fetch has been executed after the opening of cursor.

Returns TRUE if fetch executed has been successful.

Returns FALSE if there is no row has been returned.

%NOTFOUND Returns INVALID_CURSOR if the cursor is declared but has been closed or not opened.

Returns NULL if no fetch has been executed after the opening of cursor.

Returns FALSE if fetch executed has been successful.

Returns TRUE if there is no row has been returned.

%ROWCOUNT Returns INVALID_CURSOR if the cursor is declared but has been closed or not opened.

Returns the number of rows fetched.

Let’s understand, how to use cursor attributes from the help of the below PLSQL function:

view source
print?
1CREATE OR REPLACE FUNCTION GetSalary
2IS
3cur_sal NUMBER;
4CURSOR cur_salary
5IS
6  SELECT salary
7  FROM employee;
8BEGIN
9CLOSE cur_salary;
10FETCH cur_salary IN cur_sal;
11IF cur_salary%NOTFOUND THEN
12      cur_sal := 100000;
13END IF;
14CLOSE cur_salary;
15END;

The statement IF cur_salary%NOTFOUND; shows us the use of %NOTFOUND attribute of cursor cur_salary.


Filed Under: plsql Tagged With: AttributesCursorPLSQL, CURSORPLSQL, oracle sql attribues of cursor syntax and example, oracle sql plsql attributes of cursor, what are attribues of cursor in oracle plsql

Copyright © 2025 · Parallax Pro on Genesis Framework · WordPress · Log in