Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What is cursor variables or ref cursor?


Asked by Ahmir Guevara on Dec 01, 2021 FAQ



A cursor variable is a variable of REF CURSOR data type which is a pointer to a data structure resource. It connects to query statement result, similar to the CURSOR data type.
Likewise,
A ref cursor is a variable, defined as a cursor type, which will point to, or reference a cursor result. The advantage that a ref cursor has over a plain cursor is that is can be passed as a variable to a procedure or a function. The REF CURSOR can be assigned to other REF CURSOR variables.
Indeed, A cursor variable is a variable of REF CURSOR data type which is a pointer to a data structure resource. It connects to query statement result, similar to the CURSOR data type.
In fact,
The REF CURSOR variable is not a cursor, but a variable that points to a cursor. Before assigning a cursor variable, a cursor type must be defined. type author_cursor is ref cursor; This REF CURSORis a weak typed cursor variable because it does not define the datatype the cursor will return.
And,
SPL supports the declaration of a cursor variable using both the SYS_REFCURSOR built-in data type as well as creating a type of REF CURSOR and then declaring a variable of that type. SYS_REFCURSOR is a REF CURSOR type that allows any result set to be associated with it. This is known as a weakly-typed REF CURSOR.