Oracle APEX template application

The first setup of an application is always a time consuming activity. To reduce that for all APEX developers I have create a template application with custom login functions.

The package includes all tables and functions you need to up and run you complete APEX application with a few clicks.

You can download the complete app

https://github.com/apex-base/orclapex

User the below code to get your own username en password

declare
 
 l_user_name varchar2(100);
 l_user_pwd varchar2(100);
 
 begin
 l_user_name :='admin@apex-base.com';
 l_user_pwd := APP_SECURITY_PKG.get_hash('admin@apex-base.com','Welcome01');
 
 UPDATE app_user
 SET
 usr_name = l_user_name,
 usr_pwd = l_user_pwd
 WHERE
 usr_id = 1;

end;

 

Any question? drop a comment.

Oracle APEX deployment on Runtime environment

Oracle APEX is just like other development tools, it has development environment and runtime environment. In runtime environment you can not login into the workspace to deploy or modify the application. Normally is this the production environment, because you don’t want any changes to be done in the development environment.

You can install application by running the below script as SYSDBA or APEX_050100 user.

  • create the workspace
ALTER SESSION SET CURRENT_SCHEMA = APEX_050100;
BEGIN
 APEX_INSTANCE_ADMIN.ADD_WORKSPACE ( P_WORKSPACE_ID => null,
 P_WORKSPACE => 'LAB',
 P_PRIMARY_SCHEMA => 'LABSCH');
END;
/
  • Then install the application using the below script. Fist check is the application exists, if yes, deleted it and then install a new version.

 

spool myapp_install_application.log;

ALTER SESSION SET CURRENT_SCHEMA = APEX_050100;
DECLARE
l_workspace_id NUMBER;
l_app_alias varchar2(100) :='MYAPP';
    l_app_schema varchar2(100) :='LABSCH';
  -- an application number of an existing application in the workspace.
  l_existing_app NUMBER := 5489207;
  -- the "new" application number, an existing number will be dropped first.
l_new_app NUMBER := 5489207;
BEGIN

-- set workspace id
SELECT  workspace_id INTO l_workspace_id
    FROM apex_workspaces
  WHERE workspace = 'LAB';

FOR c IN (SELECT  app.application_id
       FROM apex_applications app
     WHERE app.application_id = l_existing_app
   )
LOOP
apex_instance_admin.remove_application(l_existing_app);
END LOOP;

 -- generate offset for this application
 apex_application_install.generate_offset;

 -- set application workspace
 apex_application_install.set_workspace_id( l_workspace_id );

 -- set application ID
 apex_application_install.set_application_id(l_new_app);

 -- force reset application schema
 apex_application_install.set_schema(l_app_schema);

 -- Set the application alias
 apex_application_install.set_application_alias(l_app_alias);

END;
/
-- Your application as it was exported before. 
@f139.sql;

spool off;