Application Express

PreviousNext

Source Code Control

Exporting Applications

Oracle Application Express exports create SQL script files that can be imported into any Oracle Application Express instance provided the versions of Oracle Application Express are compatible. Applications can be exported directly from the Oracle Application Express Application Builder, from SQL Developer (if the connection is to the Oracle Application Express schema owner), or from the command-line.

When developers have completed development of an application, Oracle recommends that developers export their application and save it into a source code control system. This export file should then be used to build into all other environments (Testing, Production, and so on)

Automating Application Exports

The Oracle Application Express installation includes a utilities folder which contains APEXExport programs that can be used to export applications from the command-line, without requiring a manual export from the Web interface of Application Express. There are two programs available - one for exporting the entire application and the other which splits application components into separate SQL scripts.

It is recommended that you automatically back up your Oracle Application Express applications using these command line programs as part of your disaster recovery strategy. Implementing a daily database job that automatically exports all Application Express applications provides easy to implement recovery processes.

Application Splitting

Application Express applications can include optional installation scripts which provide single file deployment. The splitter generates many files, for example each page is its own SQL script file. The splitter also generates a control file that calls the split files. When combined with a source code control system such as SVN, this provides the ability to manage Oracle Application Express application change control at a fine grained level.

Packaged Applications

Applications developed in Oracle Application Express are saved as metadata in the Oracle Application Express repository within the Oracle Database. However, applications are based on various database objects such as tables and views, and may invoke other database objects such as packages, functions, and procedures. Furthermore, before running an application it may be necessary to insert, update or delete various database records. All of these DDL and DML changes should be written in SQL scripts and executed within the target environment prior to importing the Oracle Application Express application. By utilizing the Oracle Application Express Supporting Objects, these SQL script files can be uploaded and included within the application export, creating a packaged application. This will ensure that the prerequisite scripts are executed correctly.

Static files can also be incorporated into a packaged application to simplify the installation as only one file needs to be deployed.

Packaging Applications

Packaging an application combines the installation of all components needed to install or update an application. This includes database objects such as tables, database data, the Oracle Application Express application itself, all supporting files such as images, CSS, and JavaScript.

Application Installation

once an application has been packaged into a single file, you install it by uploading the application to Oracle Application Express using the import feature. Importing starts a wizard that parses the file, performs defined pre-installation checks, executes specified installation or upgrades scripts, and then installs the application. Once the Application Express application definition is installed the supporting objects can also be installed.

Debugging

Code Instrumentation

You can instrument your Oracle Application Express PL/SQL code and code within PL/SQL procedures and functions using the APEX_DEBUG_MESSAGE package. Debugging can be selectively enabled, and can be enabled at up to 7 different levels. For example:

begin
   apex_debug_message.log_message('I AM HERE');
end;

Debugging can be enabled by clicking the Debug link in the Developer Toolbar, or it can be selectively enabled using the APEX_DEBUG_MESSAGE package. For example if you wanted to enable debugging for a user named MIKE at level 3 you could issue the following Oracle Application Express API call in a before header process at the application or page level.

begin
   if :APP_USER = 'MIKE' then
      apex_debug_message.enable_debug_messages(3);
   end if;
end;
Built in Debugging

Enabling debug from the developer tool bar, via the URL, or programmatically, via the APEX_DEBUG_MESSAGE package, can enable standard Oracle Application Express debug messages. These messages indicate numerous page processing events and display highly granular timings so you can track down performance and logic errors.

Viewing Debug Output

Developers can view debug output by clicking the View Debug link in the Developer Toolbar. Debug output shows timing data to 1/10000 of a second, and displays the application user, session and other information useful to debug performance and logic issues.

Remote Debugging

You can use Oracle SQL Developer to debug PL/SQL remotely. This capability is especially useful when an application isn't failing but also isn't producing the results you expect. When implemented, SQL Developer will be invoked when the database package, procedure, or function is called from Application Express and will allow you to step through complex PL/SQL processing that's not performing its intended function. Reviewing the data values as you step through the program often helps to identify incorrect logic.