28.1 GET_APPLICATION Function

This function exports the given application and optionally splits the application definition into multiple files. The optional p_with_% parameters can be used to include additional information in the export.

Syntax

APEX_EXPORT.GET_APPLICATION (
    p_application_id            IN NUMBER,
    p_type                      IN t_export_type    DEFAULT c_type_application_source,
    p_split                     IN BOOLEAN          DEFAULT FALSE,
    p_with_date                 IN BOOLEAN          DEFAULT FALSE,
    p_with_ir_public_reports    IN BOOLEAN          DEFAULT FALSE,
    p_with_ir_private_reports   IN BOOLEAN          DEFAULT FALSE,
    p_with_ir_notifications     IN BOOLEAN          DEFAULT FALSE,
    p_with_translations         IN BOOLEAN          DEFAULT FALSE,
    p_with_pkg_app_mapping      IN BOOLEAN          DEFAULT FALSE,
    p_with_original_ids         IN BOOLEAN          DEFAULT FALSE,
    p_with_no_subscriptions     IN BOOLEAN          DEFAULT FALSE,
    p_with_comments             IN BOOLEAN          DEFAULT FALSE,
    p_with_supporting_objects   IN VARCHAR2         DEFAULT NULL,
    p_with_acl_assignments      IN BOOLEAN          DEFAULT FALSE,  
    p_components                IN apex_t_varchar2  DEFAULT NULL,
    p_with_audit_info           IN t_audit_type     DEFAULT NULL )
    RETURN apex_t_export_files;

Parameters

Parameters Description
p_application_id The application ID.
p_split If TRUE, splits the definition into discrete elements that can be stored in separate files. If FALSE, the result is a single file.
p_type

Comma-delimited list of export types to perform:

  • APPLICATION_SOURCE - export an APEX application using other parameters passed.
  • EMBEDDED_CODE - export code such as SQL, PL/SQL and JavaScript. APEX ignores all other options when EMBEDDED_CODE is selected.
  • CHECKSUM-SH1 - export a SHA1 checksum that is independent of IDs and can be compared across instances and workspaces.
  • CHECKSUM-SH256 - export a SHA-256 checksum that is independent of IDs and can be compared across instances and workspaces.
  • READABLE_YAML - export a readable version of the application metadata in YAML format.

When the parameter p_type contains APPLICATION_SOURCE and either CHECKSUM-SH1 or CHECKSUM-SH256, APEX adds an additional line with a comment containing an overall checksum at the end of the application source file or, in case of a split export, the top-level install.sql file.

p_with_date If TRUE, includes export date and time in the result.
p_with_ir_public_reports If TRUE, includes public reports that a user saved.
p_with_ir_private_reports If TRUE, includes private reports that a user saved.
p_with_ir_notifications If TRUE, includes report notifications.
p_with_translations If TRUE, includes application translation mappings and all text from the translation repository.
p_with_pkg_app_mapping

Note: This parameter is obsolete.

If TRUE, exports installed packaged applications with references to the packaged application definition. If FALSE, exports them as normal applications.

p_with_original_ids If TRUE, exports with the IDs as they were when the application was imported.
p_with_no_subscriptions If FALSE, components contain subscription references.
p_with_comments If TRUE, includes developer comments.
p_with_supporting_objects

If Y, exports supporting objects.

If I, installs on import automatically.

If N, does not export supporting objects.

If NULL, uses the application's include in export deployment value.

p_with_acl_assignments If TRUE, exports ACL user role assignments.
p_components If not NULL, exports only given components (array elements should be of form type:name, for example, PAGE:42 or MESSAGE:12345).

See view APEX_APPL_EXPORT_COMPS for components that can be exported.

Use % to indicate that all components of the given type should be exported. For example: LOV:% exports all Lists Of Values contained in the application.

p_with_audit_info

Specifies the detail of audit information to include:

  • NULL: export excludes all audit information.
  • NAMES_AND_DATES: export includes Created On, Created By, Updated On, Updated By values if they exist.
  • DATES_ONLY: export includes Created On and Updated On values if they exist. User names are excluded.

Returns

A table of apex_t_export_file. Unless the caller passes p_split=>true to the function, the result is a single file.

Example 1

This SQLcl code fragment spools the definition of application 100 into file f100.sql.

variable name varchar2(255)
variable contents clob
DECLARE
   l_files apex_t_export_files;
BEGIN
   l_files := apex_export.get_application(p_application_id => 100);
   :name := l_files(1).name;
   :contents := l_files(1).contents;
END;
/
set feed off echo off head off flush off termout off trimspool on
set long 100000000 longchunksize 32767
col name new_val name
select :name name from sys.dual;
spool &name.
print contents
spool off

Example 2

The following example shows an install.sql file that was exported with p_type => 'APPLICATION_SOURCE,CHECKSUM-SH1'

prompt --install
@@application/set_environment.sql
@@application/delete_application.sql
...snip...
@@application/deployment/buildoptions.sql
@@application/end_environment.sql
-- Application Checksum SH1:jpcliMUZZDVVBI1MKpyyAfPBDww=