6 Replies Latest reply: Apr 9, 2013 5:33 AM by Joni Vandenberghe RSS

    wwv_flow_utilities.export_workspace_to_clob

    Joni Vandenberghe
      Hi,

      I have the VM from the oracle Developer days. The only thing that is different is that APEX is upgraded to 4.2.

      When I execute this piece of code:
      declare
      v_clob CLOB;
      begin
      v_clob := apex_040200.wwv_flow_utilities.export_workspace_to_clob( p_workspace_id => 2626323717160271
      , p_include_team_development => FALSE);
      end;

      I get an error:
      Error report:
      ORA-06502: PL/SQL: numeric or value error: NULL index table key value
      ORA-06512: at "APEX_040200.WWV_FLOW_SECURITY", line 645
      ORA-06512: at "APEX_040200.WWV_FLOW_FND_USER_API", line 138
      ORA-06512: at "APEX_040200.WWV_FLOW_FND_USER_API", line 289
      ORA-06512: at "APEX_040200.WWV_FLOW_UTILITIES", line 10051
      ORA-06512: at "APEX_040200.WWV_FLOW_UTILITIES", line 10075


      I am able to execute the same procedure on an internal DB withouth problems. Any idea why it would fail here? And the number 2626323717160271, is the id from a workspace, just so you know :-)
        • 1. Re: wwv_flow_utilities.export_workspace_to_clob
          Howard (... in Training)
          Joni,

          Re:
          declare
          v_clob CLOB;
          begin
          v_clob := apex_040200.wwv_flow_utilities.export_workspace_to_clob 
                            ( p_workspace_id => 2626323717160271
          , p_include_team_development => FALSE);
          end;
          There are two variables here: "FALSE" and the workspace ID. Off the top of my head, I'm guessing workspace ID can't be found where you are trying to do this. You say VM and Internal DB. Are these two different workspaces? Is this in the same workspace that where other execution of the code worked?

          What do you think?
          Howard
          • 2. Re: wwv_flow_utilities.export_workspace_to_clob
            Joni Vandenberghe
            Yeah as I said it is a real workspace ID, I checked it, doublechecked it and triplechecked it.
            I did not try it with the same workspace no, just a random workspace from the other DB.

            I can't seem to figure out why one works, and one doesn't. The workspace is a normal workspace with developers, applications, team dev,...
            The export application to clob function works fine on both btw.
            • 3. Re: wwv_flow_utilities.export_workspace_to_clob
              Howard (... in Training)
              Re:
              it is a real workspace ID, I checked it, doublechecked it and triplechecked it.
              Just to be sure, what I was trying to ask was: "It's a real workspace ID ... for THE workspace you are exporting from?"

              If it can't seem to find this ID, one reason would be it's not the "right" workspace. As a test, does it throw the same error if you use ID 999999999999999999999? Maybe it can't "see" this workspace or maybe it can't "see" any workspaces.

              You always find something in the last place you look.
              Howard
              • 4. Re: wwv_flow_utilities.export_workspace_to_clob
                Joni Vandenberghe
                Yes it's a real workspace id, but I guess your right not to take my word for it, see for yourself:
                https://dl.dropbox.com/u/11641108/workspace%20id.png

                I tracked down the problem a little bit more. The reason it worked on the other DB was because I tested it there in the Apex schema. And on the VM on my local schema. On the Apex of my VM it does work, it also works when I give in a fake workspace id btw, then it just creates a clob that tries to create an empty workspace with that ID.

                I also tried out all other export methods in my own schema, and they all work. The only one that doesn't is this function and the procedure export_workspace. I granted myself the APEX_ADMINISTRATOR_ROLE aswell, and ofc I got execute rights on the package wwv_flow_utilities.
                • 5. Re: wwv_flow_utilities.export_workspace_to_clob
                  Nick B
                  Hey Joni,

                  I experienced that very same error in an APEX 4.2 environment when trying to execute the "export_workspace_to_clob" function. Never had this error on my 4.1.1 instance though. I'm pretty sure you need something extra in your code to cope with security and user context. These security measures are only necessary for the workspace export.
                  wwv_flow_api.set_security_group_id(2626323717160271);
                  -- set the apex_application.g_user global variable...
                  -- the username you use as argument needs admin privileges in the workspace
                  apex_custom_auth.set_user('admin');
                  More information can be found here: http://apexplained.wordpress.com/2012/03/20/workspace-application-and-page-export-in-plsql/

                  I'm afraid, however, that these extra lines of code will not solve your issue. I never succeeded in resolving the above error :`(

                  Nick
                  • 6. Re: wwv_flow_utilities.export_workspace_to_clob
                    Joni Vandenberghe
                    declare
                      l_clob CLOB;
                    BEGIN
                      wwv_flow_api.set_security_group_id(2626323717160271);
                      apex_custom_auth.set_user('admin');
                    
                      l_clob := wwv_flow_utilities.export_workspace_to_clob(p_workspace_id             => 2626323717160271
                                                                          , p_include_team_development => FALSE);
                    
                      end;
                    Actually this worked for me thanks for the link Nick!