28.5 UNZIP Function
This function extracts and decompresses all the files from a zip archive.
This function is intended for use with the routines in the APEX_APPLICATION_INSTALL
package and assumes that all of the files in the ZIP archive are in a text format, such as SQL scripts (which must have a .sql
extension) or simple README
files.
All text content in the ZIP file must be encoded as UTF-8.
Syntax
APEX_EXPORT.UNZIP (
p_source_zip IN BLOB )
RETURN apex_t_export_files;
Parameters
Parameter | Description |
---|---|
p_source_zip |
A BLOB containing the zip archive. |
Returns
This function returns a table of apex_t_export_file
containing the name and contents (converted to text format) of each file from the ZIP archive.
Example
The following example fetches an application archive from a remote URL, extracts the files within it, and prints the type and name of the contained application.
DECLARE
l_zip blob;
l_info apex_application_install.t_file_info;
BEGIN
l_zip := apex_web_service.make_rest_request_b (
p_url => 'https://www.example.com/apps/f100.zip',
p_http_method => 'GET' );
l_info := apex_application_install.get_info (
p_source => apex_export.unzip (
p_source_zip => l_zip ) );
sys.dbms_output.put_line (
apex_string.format (
p_message => q'~
!Type ................. %0
!App Name ............. %1
!~',
p0 => l_info.file_type,
p1 => l_info.app_name,
p_prefix => '!' ));
END;
Parent topic: APEX_EXPORT