Answer the question
In order to leave comments, you need to log in
Does the cursor in a for loop statement in Oracle close when the function exits?
The official documentation does not describe what happens to the cursor if called RETURN
inside CURSOR FOR LOOP STATEMENT
. Perhaps I misunderstood something, so I'm asking here if the cursor closes or not?
Maybe someone met with a similar situation in the process of work and knows for sure, or can tell where to dig?
Approximate description of the function:
FUNCTION FUNC_NAME RETURN VARCHAR2
AS
CURSOR cursor_name IS SELECT DISTINCT field_name FROM table_name;
BEGIN
FOR row IN cursor_name LOOP
RETURN NULL; -- Закроется ли курсор после выполнения этой строки?
END LOOP;
RETURN NULL;
END FUNC_NAME;
Answer the question
In order to leave comments, you need to log in
During an exception, the cursor closes automatically. I think that during the return too.
A quick search turned up this:
Oracle PL/SQL For Dummies. Authors: Michael Rosenblum,Paul Dorsey
page 152
Found at this link.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question