2 Replies Latest reply on Feb 13, 2013 11:44 PM by VANJ

    Bind variable notation or set_session_state

      APEX 4.2.1

      Use case: During page processing, use user input on form controls rendered using the apex_item API to set session state for a page and then branch to that page. Normally, this is done using the f?p=...:10:P10_X:1 to clear cache for Page 10 and set the value for P10_X as specified. Of course, apex_application.g_fXX cannot be used in the f?p= URL so I created a process that does
      apex_util.clear_page_cache(10); :P10_X := apex_application.g_f01(1);
      followed by a branch that does a redirect to page 10.

      To my surprise, P10_X was not set when page 10 was rendered. As if the clear_page_cache() was executed after the assignment to P10_X. But navigating away from the page and then back to it suddenly shows the value previously set. Or something like that, very weird. Simply changing the assignment to use
      fixes the issue.

      Over the years, I have been involved in Session state not set until process completes? htmldb_util.set_session_state not working with Scott Spadafore about the semantics of session state maintenance, when it is updated and such, but I am still unsure as to when, if ever, to use bind variable notation to set session state vs apex_util.set_session_state. If we can live with the fact that set_session_state does a immediate COMMIT, I don't see any benefit to using bind variable notation at all. Is that a valid conclusion to draw?