Oracle cursors are often used. The following describes the differences between oracle cursors and cursors. If you are interested in oracle cursors, take a look.
Oracle cursor is a named workspace in the database. When the cursor is declared, it is associated with a fixed SQL statement. It is known at the time of compilation and static. it always points to the same query workspace.
The cursor variable can be associated with different SQL statements at runtime, and different SQL statements can be used at runtime. It can reference different workspaces.
Oracle cursors and cursors cannot replace each other.
How to define the cursor type
TYPE ref_type_name is ref cursor [RETURN return_type];
Declare cursor variable
Cursor_name ref_type_name;
Ref_type_name is the type of our CURSOR to be used when the CURSOR variable is declared later (the custom CURSOR type, that is, the CURSOR is the system default, and the ref_type_name is what we define ); return_type indicates a row in the database table or a record type.
TYPE ref_type_name is ref cursor return employee % TYPE
RETURN is optional. If there is a strong type, errors can be reduced. If no return is a weak reference, it has better flexibility.
You cannot declare the cursor variable in the header. Note that you can define the cursor type. Pay attention to the differences between the two.
You can declare a cursor variable as a parameter in the form of a function or process.
% Type a column TYPE
% ROWTYPE Row Type
Control oracle cursor Variables
OPEN-FOR (OPEN the cursor variable, connected to multi-row queries) FETCH (get row data from the result set), close (close the cursor variable)
The bulk collect clause extracts the rows in the cursor variable into a collection at a time.
Oracle cursor expressions and table functions
Use instances of Oracle stored procedures
Oracle command line custom editor vi
Implementation of oracle command line Logon
Oracle queries table space usage