PL/SQL INTERVIEW QUESTION & ANSWERS
41. |
What is REF Cursors? |
|
A ref cursor is a cursor variable which is a reference type. It is similiar to pointers in C. It can name different storage locations at the program runs. The syntax of REF cursors is as follows
TYPE type_name IS REF CURSOR RETURN return_type; |
42. |
Why use Cursor Variables? |
|
Cursor variables to pass query result sets between PL/SQL stored subprograms and various clients. PL/SQL and its clients share a pointer to the query work area in which the result set is stored. |
43. |
How to fetch a cursor variable? |
|
The FETCH statement retrieves rows from the result set of a multi-row query. It works
the same with cursor variables as with explicit cursors. |
44. |
How to closing a cursor variable? |
|
- The CLOSE statement disables a cursor variable and makes the associated result set undefined.
- Close the cursor variable after the last row is processed.
-
When declaring a cursor variable as the formal parameter of a subprogram that closes the cursor variable, you must specify the IN or IN OUT mode.
|
45. |
What is the use of functions? |
|
A function is a subprogram that computes a value. It differs from Procedure as function returns a value. |