I have a procedure that calls a function. After few procedure calls it is not executing that function anymore. Also there are no exceptions thrown. When I deleted the session_id from browser and refreshed it, everything starts to work as expected but not permanent.. After few procedure calls again it is starting to act weird again.. I red an article where was said something that when deleting the session id then all SYS_REFCURSORs also are deleted.
I put below modified code example how approximately everything looks, but could not show the real one because I'm not allowed to do that.
I would like to hear some opinions and possible reasons why this could happen.
Procedure that is called from DA:
PROCEDURE search_user(i_max_row_count IN INTEGER,
i_session_id IN NUMBER,
i_user_id IN some_common_logic.user_ids,
cur_out OUT SYS_REFCURSOR)
IS
BEGIN
GetResult(i_max_row_count, i_session_id, cur_out);
END;
Procedure that calls the function:
PROCEDURE getresult(i_max_row_count IN INTEGER,
i_session_id IN NUMBER,
cur_out OUT SYS_REFCURSOR)
IS
--some variables
BEGIN
OPEN cur_out FOR
SELECT
rownum,
users.user_id AS "ID"
FROM users
WHERE users.user_id IN (SELECT object_id
FROM TABLE (get_user_id(i_max_row_count, i_session_id)));
END;
Funciton that is not called:
FUNCTION Get_User_Id(i_max_row_count IN INTEGER,
i_session_id IN NUMBER)
RETURN FilterRows pipelined
IS
cur INTEGER := DBMS_SQL.OPEN_CURSOR;
BEGIN
DBMS_OUTPUT.PUT_LINE('Get_User_Id is called!');
--some logic here
DBMS_SQL.CLOSE_CURSOR(cur);
RETURN;
END;