Today while working on Oracle Application Express, I came across a situation, where I need to define same variables (Application Items) in another 2-3 different applications. Moreover these application may or may not be residing in same Workspace.
I could have created the item manually across all the applications, but being a programmer brain plus lazy butt, I don’t wanted to give up.
I did following and it worked more than fine to me.
I navigate to “Share Components” Page of source Application
On the right hand side under “Tasks”, I selected “Export Application Components”
Exported only the ” Application Items”
Save the file as “f110_components.SQL”
Open the file in notepad
Changed following three things depending on the target application number and workspace.
Get the Workspace ID using following SQL at your target and note down the Workspace ID.
“select WORKSPACE_ID from APEX_WORKSPACES”
Search for following function in the file:
wwv_flow_api.set_security_group_id
Change it using following syntax
wwv_flow_api.set_security_group_id(p_security_group_id=>OB_WORKSPACE_ID);
Where OB_WORKSPACE_ID is Workspace ID
example in my case it was “5622003592886707″ so I changes as follows:
wwv_flow_api.set_security_group_id(p_security_group_id=>5622003592886707);
The search for the line where following variable is being initialized
wwv_flow.g_flow_id
Change it using following syntax
wwv_flow.g_flow_id := OB_APPLICATION_ID;
Where OB_APPLICATION_ID is the Application ID or you can say Application Number
In my case it was 136 I changed it as follows:
wwv_flow.g_flow_id := 136;
Hint: Application Express always shows Application ID beside your application name.
The search for the line where following variable is being initialized
wwv_flow_api.g_id_offset
Change it using following syntax
wwv_flow_api.g_id_offset := OB_RANDOM_NUMBER;
Where OB_RANDOM_NUMBER is any random INTEGER other than zero
Script Before Change:
……….
…..
prompt Set Credentials…
begin
– Assumes you are running the script connected to SQL*Plus as the Oracle user APEX_030200 or as the owner (parsing schema) of the application.
wwv_flow_api.set_security_group_id(p_security_group_id=>1122003592886707);
end;
/
…..
……
prompt Set Application ID…
begin
– SET APPLICATION ID
wwv_flow.g_flow_id := 110;
wwv_flow_api.g_id_offset := 0;
null;
end;
/
……
……
Script After Change:
……….
…..
prompt Set Credentials…
begin
– Assumes you are running the script connected to SQL*Plus as the Oracle user APEX_030200 or as the owner (parsing schema) of the application.
wwv_flow_api.set_security_group_id(p_security_group_id=>5622003592886707);
end;
/
…..
……
prompt Set Application ID…
begin
– SET APPLICATION ID
wwv_flow.g_flow_id := 136;
wwv_flow_api.g_id_offset := 1;
null;
end;
/
……
……
After that imported into my target application without any error.
hope this will help somebody!
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment