The explicit cursors are static cursors as they are associated with only one SQL statement, which is known when the block is compiled. A cursor variable can be associated with different queries at runtime. They are like variables that can hold different values at runtime.
A cursor variable is a reference type, which is similar to pointers in the C language. It can refer to different storage locations at runtime. To use cursor variable, it should be first declared and storage has to be allocated. Following is the syntax to define cursor variable:
Type type_name IS REF CURSOR [RETURN return_type]
In the preceding syntax, type_name refers to the new reference type and returnjype refers to the RECORD type returned by the cursor variable.
TYPE t_employeeRef is REF CURSOR RETURN t_employee%ROWTYPE
----defination of type REF CURSOR
v_employeeCV t_employeeRef
----declaration of cursorvariable
A cursor variable is a reference type, which is similar to pointers in the C language. It can refer to different storage locations at runtime. To use cursor variable, it should be first declared and storage has to be allocated. Following is the syntax to define cursor variable:
Type type_name IS REF CURSOR [RETURN return_type]
In the preceding syntax, type_name refers to the new reference type and returnjype refers to the RECORD type returned by the cursor variable.
TYPE t_employeeRef is REF CURSOR RETURN t_employee%ROWTYPE
----defination of type REF CURSOR
v_employeeCV t_employeeRef
----declaration of cursorvariable