2 Replies Latest reply: Apr 14, 2011 9:06 PM by 720456 RSS

    Exception "ORA-06531" is raised out when calling DBMS_WM.MergeTable

      Recently in my project, we have the requirement of creating workspace, do modification in this workspace and at last merge all selected changed back to original dataset ( "LIVE" workspace ). The OWM version we are using is "" together with Oracle version "Oracle Database 10g Enterprise Edition Release - Prod".

      The 11 tables we placed in the workspace manager are all in 3NF and have FK defined, with top level table refering to tables that are not in OWM. All workspaces' parent are LIVE. It works fine for normal modification in workspace. However, we encounter one weird issue when calling OWM built-in API DBMS_WM.MergeTable to merge selected data into LIVE workspace by specifiying the where_clause parameter by "id = xxx".

      The expected merge process is:
      1. User select data through UI;
      2. DB codes call DBMS_WM.MergeTable for selected data one table by one table and one row by one row.

      We are now blocked since we sometimes got the one exception saying

      +"ORA-06531: Reference to uninitialized collection+
      ORA-06512: at "WMSYS.LT", line 7203".*

      This exception happens in a random way. Sometimes it happens and the other time does not, even if I call the same API with the same parameter ( of course, after each call, I rollbacked the merge ).

      My first guess is the merge has something to do with the table order. Then I tried merge either parent first or child first, this issue remains. In both test, I just call DBMS_WM.MergeTable directly, no additional codes involved. More strange thing is: in the Test 1, I merged child table prior to parent table, which errors out with above exception. Then in the Test 2, I merged parent table prior to child table. In this time, it works. Then I rollbacked the merge operation and try Test 1 again. To my suprise, it works.

      I then google the internet, no thread describes this issue. Is there anything wrong with my environment or implementation? Please advise.

      Thanks in advance

      Edited by: user5736610 on 2011-4-14 上午2:12

      Edited by: user5736610 on 2011-4-14 上午2:16
        • 1. Re: Exception "ORA-06531" is raised out when calling DBMS_WM.MergeTable
          Ben Speckhard-Oracle

          I haven't seen this before, and not sure what could be causing it. You'll need to get a stack trace so the exact location of the error can be identified.

          SQL> alter session set events '06531 trace name errorstack level 1, forever';

          • 2. Re: Exception "ORA-06531" is raised out when calling DBMS_WM.MergeTable
            It seems the RCA has been found.

            We have a trigger in one of the OWM tables, which has invoked a package who has a global collection not initialized. Having that piece of code fixed, this exception is not happening any more.

            When debugging the code, I traced to the exception in WMSYS codes that invoked this trigger.

            As to why sometimes it happens and the other time does not, that's because in that package containing the global collection, one of its procedure initialized this collection. Therefore, we may happened to invoked that API and got collection initialized. This is totally a code issue in our side.


            Edited by: user5736610 on 2011-4-14 下午7:03