Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue with APEX_APPLICATION_INSTALL.SET_WORKSPACE_ID

Joseph UpshawAug 25 2021 — edited Nov 30 2021

APEX v. 20.2
The overall attempt will be to import an application into a different workspace. To do this, I query the ID of the target workspace (thereby, guaranteeing that it is a valid workspace ID). When I subsequently try to set it, however, I get this error stack (I sure wish they hadn't removed the code option for content in these posts!):
ORA-20987: APEX - Invalid workspace ID. - Contact your application administrator.
Details about this incident are available via debug id "498841".
ORA-06512: at "APEX_200200.WWV_FLOW_ERROR", line 1040
ORA-06512: at "APEX_200200.WWV_FLOW_ERROR", line 1407
ORA-06512: at "APEX_200200.WWV_FLOW_APPLICATION_INSTALL", line 91
ORA-06512: at line 30
Here is a very simple script to demonstrate the issue:

DECLARE

  TARGET_WORKSPACE   CONSTANT APEX_WORKSPACES.WORKSPACE%TYPE := 'RACE:GIDES';

  TARGET_APPLICATION_ID CONSTANT APEX_APPLICATIONS.APPLICATION_ID%TYPE := 166;

  ln_WorkspaceID    APEX_WORKSPACES.WORKSPACE_ID%TYPE;

  ls_DefaultSchemaName APEX_WORKSPACE_SCHEMAS.FIRST_SCHEMA_PROVISIONED%TYPE;
 
  CURSOR lcsr_GetTargetWorkspace IS
    SELECT WORKSPACE_ID
    FROM APEX_WORKSPACES
    WHERE WORKSPACE = TARGET_WORKSPACE;
  
  CURSOR lcsr_GetDefaultSchemna IS
    SELECT DISTINCT FIRST_SCHEMA_PROVISIONED  
    FROM APEX_WORKSPACE_SCHEMAS 
    WHERE WORKSPACE_NAME = TARGET_WORKSPACE;

BEGIN

  OPEN lcsr_GetTargetWorkspace;

  FETCH lcsr_GetTargetWorkspace INTO ln_WorkspaceID;

  CLOSE lcsr_GetTargetWorkspace;

  OPEN lcsr_GetDefaultSchemna;

  FETCH lcsr_GetDefaultSchemna INTO ls_DefaultSchemaName;

  CLOSE lcsr_GetDefaultSchemna;

  APEX_APPLICATION_INSTALL.SET_WORKSPACE_ID( ln_WorkspaceID );

  APEX_APPLICATION_INSTALL.GENERATE_OFFSET;

  APEX_APPLICATION_INSTALL.SET_SCHEMA( ls_DefaultSchemaName );

  APEX_APPLICATION_INSTALL.SET_APPLICATION_ID( TARGET_APPLICATION_ID );

  APEX_APPLICATION_INSTALL.SET_APPLICATION_ALIAS( 'F' || APEX_APPLICATION.GET_APPLICATION_ID );

END;
/

Anyone have any idea what the issue is here? This whole approach is taken essentially straight from the Oracle documentation (https://docs.oracle.com/cd/E59726_01/doc.50/e39149/apex_app_inst.htm#CHDFGAIF under the section labelled Import Application into Different Workspace using Different Schema.
Thanks,
-Joe

Comments
Post Details
Added on Aug 25 2021
8 comments
1,572 views