Cursor %NOTFOUND
Hi ,
I am trying to determine if a cursor that does not return any rows, does it need to be explicity closed after opening and checking thet %NOTFOUND is true
For example,
Lets say I have a cursor
Cursor C_get_value is
SELECT col1 frpm table where condition1= 'true';
Now when I open my cursor as following:
OPEN C_get_value;
FETCH C_get_value INTO O_value;
IF C_get_value%NOTFOUND THEN
O_error_message := 'Invalid values ';
RETURN 1;
END IF;
CLOSE C_get_value;
Lets assume that C_get_value%NOTFOUND was true and the condition1 was never met for the select query.
Now do I need to explicitly close the cursor C_get_value before Return 1?
OPEN C_get_value;
FETCH C_get_value INTO O_value;
IF C_get_value%NOTFOUND THEN
O_error_message := 'Invalid values ';
CLOSE C_get_value;
RETURN 1;
END IF;
CLOSE C_get_value;
Please help me with this.
Thanks,
Neha