How do you open and close a cursor variable. Why it is required?

Q

How do you open and close a cursor variable. Why it is required?

✍: Guest

A

Using OPEN cursor_name and CLOSE cursor_name commands. The cursor must be opened before using it in order to fetch the result set of the query it is associated with. The cursor needs to be closed so as to release resources earlier than end of transaction, or to free up the cursor variable to be opened again.

2011-10-31, 2787👍, 0💬