Skip to content

Instantly share code, notes, and snippets.

@Dani3lSun
Last active January 2, 2016 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dani3lSun/461a6d6f6eb991107802 to your computer and use it in GitHub Desktop.
Save Dani3lSun/461a6d6f6eb991107802 to your computer and use it in GitHub Desktop.
Get BLOB / Filename / Mime_Type from apex_application_temp_files
CREATE OR REPLACE PROCEDURE get_apex_temp_file(i_item_value IN VARCHAR2,
o_blob OUT BLOB,
o_filename OUT VARCHAR,
o_mime_type OUT VARCHAR2) IS
--
l_workspace_id NUMBER;
l_app_id NUMBER;
--
CURSOR l_cur_apex_blob IS
SELECT atf.blob_content,
atf.filename,
atf.mime_type
FROM apex_application_temp_files atf
WHERE atf.application_id IN (l_app_id,
0)
AND atf.name = i_item_value
ORDER BY atf.id DESC;
--
BEGIN
--
l_app_id := v('APP_ID');
--
-- set Apex Workspace ID and Security Group ID
SELECT workspace_id
INTO l_workspace_id
FROM apex_applications
WHERE apex_applications.application_id = l_app_id;
--
apex_util.set_security_group_id(p_security_group_id => l_workspace_id);
--
-- Open APEX_TEMP_FILES Cursor and fetch into vars
OPEN l_cur_apex_blob;
FETCH l_cur_apex_blob
INTO o_blob,
o_filename,
o_mime_type;
CLOSE l_cur_apex_blob;
--
END get_apex_temp_file;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment