This discussion is archived
9 Replies Latest reply: Dec 11, 2012 5:20 AM by Edwin van Meerendonk RSS

Two different processes. 2nd does not see 1st one's changes.

ZairS. Newbie
Currently Being Moderated
Hi,

I use 11g and apex4.1.

Having *2 processes* in a page. 1st one is ApplyMRU and second one is pl/sql anonymous block. Changes made by 1st one is not recognized in second one.

I think in this case transactions made separately. And commit is done after all processes.

What is the best solution for it?
  • 1. Re: Two different processes. 2nd does not see 1st one's changes.
    714270 Pro
    Currently Being Moderated
    Hi,

    Would it be possible to setup an example in apex.oracle.com?



    Thanks,
    Rohit
  • 2. Re: Two different processes. 2nd does not see 1st one's changes.
    ZairS. Newbie
    Currently Being Moderated
    I am sorry, it is too much to do.
  • 3. Re: Two different processes. 2nd does not see 1st one's changes.
    Mindmap Pro
    Currently Being Moderated
    Hello Zair,
    And commit is done after all processes.
    As I got each process is an isolated transaction, for if one of them fails, the next process is executed.

    Not sure what is the problem you have.. However, how about you start you second PL/SQL process with
    COMMIT ;
    Best Regards,
    Fateh
    ------------
    If you believe that my answer is correct or even helpful to you, then please mark the answer as helpful or correct
  • 4. Re: Two different processes. 2nd does not see 1st one's changes.
    fac586 Guru
    Currently Being Moderated
    Fateh wrote:
    And commit is done after all processes.
    As I got each process is an isolated transaction, for if one of them fails, the next process is executed.
    The same database session is used for the duration of the "show page" or "accept page" request. If a "direct branch" (Branch to Page without using redirect) is performed after "accept page" processing, the same session is used to show the new page.

    Multiple transactions may be involved, as When commit is executed?. (I think the information in that post is now somewhat out of date, but I have not come across a complete description of the current behaviour from a trusted source like Scott...)
    Not sure what is the problem you have..
    Exactly. That's why reproducing the problem on apex.oracle.com is necessary. There's no point in anyone sitting here making random guesses without knowing exactly what is happening. A debug trace would be at least a small step in the right direction.
    However, how about you start you second PL/SQL process with
    COMMIT ;
    Don't. I've been using APEX for 7 years and have never used <tt>commit</tt> in any process code. I recently found one in a package called by the first app I wrote. It wasn't necessary there either. As described above, APEX is almost certainly commiting more frequently than is actually desirable. Adding extra commits is likely to break transactional integrity, not fix it.
  • 5. Re: Two different processes. 2nd does not see 1st one's changes.
    ZairS. Newbie
    Currently Being Moderated
    Fateh,

    I dont want to start with commit.

    I think standart ApplyMRU had to be with option of if to commit after this process or not.

    Thanks.
  • 6. Re: Two different processes. 2nd does not see 1st one's changes.
    ZairS. Newbie
    Currently Being Moderated
    fac586,

    my question is not specific to my application. It is a general question. So, that is why I dont want to deploy it to global.

    The question is simple.

    Does every process start a new session to db if multiple processes are used in a page? If yes, how to commit after process if it is standart ApplyMRU process before second process or session for process is started?
  • 7. Re: Two different processes. 2nd does not see 1st one's changes.
    fac586 Guru
    Currently Being Moderated
    Zair S. wrote:

    my question is not specific to my application. It is a general question. So, that is why I dont want to deploy it to global.

    The question is simple.

    Does every process start a new session to db if multiple processes are used in a page?
    No. As stated in the response above:
    The same database session is used for the duration of the "show page" or "accept page" request. If a "direct branch" (Branch to Page without using redirect) is performed after "accept page" processing, the same session is used to show the new page.
    Multiple transactions may be involved, depending on when/how changes are made to values in session state.

    It's therefore likely that the problem is specific to your application.
  • 8. Re: Two different processes. 2nd does not see 1st one's changes.
    Patrick Wolf Employee ACE
    Currently Being Moderated
    Hi Zair,

    as fac586 has already pointed out, APEX will NOT execute each process in its own transaction/database session. All processes/computations/... are executed in the same database when a page is submitted.

    Back to your original question
    Changes made by 1st one is not recognized in second one.
    What do you mean with recognized? Are you selecting the updated values from the database again and the changes are not returned?
    BTW, have you verified that the ApplyMRU has actually fired, because they normally do have a condition on them. You should run and submit your page in debug mode and verify that.

    Regards
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf
  • 9. Re: Two different processes. 2nd does not see 1st one's changes.
    Edwin van Meerendonk Explorer
    Currently Being Moderated
    Seems like a silly one, but make sure the sequence number of your proces is higher that that of the ApplyMRU

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points