61.7 GET_FILES Function (Deprecated)

Caution:

This API is deprecated and will be removed in a future release.

Use GET_DIR_ENTRIES Function instead.

This function returns an array of file names, including the path, of a provided zip file that contains a BLOB.

Syntax

APEX_ZIP.GET_FILES (
    p_zipped_blob IN BLOB,
    p_only_files  IN BOOLEAN DEFAULT TRUE,
    p_encoding    IN VARCHAR2 DEFAULT NULL )
RETURN t_files;

Parameters

Parameter Description
p_zipped_blob This is the zip file containing the BLOB.
p_only_files If set to TRUE, empty directory entries are not included in the returned array. Otherwise, set to FALSE to include empty directory entries.
p_encoding This is the encoding used to zip the file.

Returns

Return Description
t_files A table of file names and path. See "Data Types" for more details.

Example

This example demonstrates reading a zip file from a table, extracting it and storing all files of the zip file into my_files.

declare
    l_zip_file      blob;
    l_unzipped_file blob;
    l_files         apex_zip.t_files;
begin
    select file_content
        into l_zip_file
        from my_zip_files
    where file_name = 'my_file.zip';

    l_files := apex_zip.get_files (
            p_zipped_blob => l_zip_file );

    for i in 1 .. l_files.count loop
        l_unzipped_file := apex_zip.get_file_content (
            p_zipped_blob => l_zip_file,
            p_file_name   => l_files(i) );

        insert into my_files ( file_name, file_content )
        values ( l_files(i), l_unzipped_file );
    end loop;
end;