Oracle cursor is familiar to everyone. The following describes common attributes of Oracle cursor in detail. If you are interested in Oracle cursor, take a look.
Common Oracle cursor attributes:
% FOUND: When the variable finally obtains the record from the cursor, the record is FOUND in the result set.
% NOTFOUND: When the variable finally retrieves records from the cursor, no records are found in the result set.
% ROWCOUNT: number of records that have been obtained from the cursor at the current time.
% ISOPEN: whether or not to open.
- Declare
-
- /* Define a static cursor */
-
- Cursor emps is
-
- Select * from employees where rownum <6 order by 1;
-
- Emp employees % rowtype;
-
- Row number: = 1;
-
- Begin
-
- Open emps;/* Open static cursor */
-
- Fetch emps into emp;/* read the current row of the cursor */
-
- Loop
-
- If emps % found then
-
- Dbms_output.put_line ('looping over record '| row |' of '| emps % rowcount );
-
- Fetch emps into emp;
-
- Row: = row + 1;
-
- Elsif emps % notfound then
-
- Exit;
-
- End if;
-
- End loop;
-
- If emps % isopen then
-
- Close emps;/* Close the cursor */
-
- End if;
-
- End;
-
- /
-
Edit recommendations]
Create tables and indexes in Oracle
How to Implement Oracle index Reconstruction
Complete Oracle File System Parsing
How to query the current Oracle system time
ORACLE system table and data dictionary View