2 Replies Latest reply: Feb 19, 2013 6:21 PM by 560577 RSS

    Set Session Id in PL/SQL

    HarryF
      I want to have a central procedure in Oracle outside of APEX to handle uploading files to Oracle. I need to run the following query but it won't work without session set:

      select blob_content,filename,mime_type,dad_charset
      into l_blob_data,l_orig_filename,l_mime_type,l_dad_charset
      from wwv_flow_files

      I know I can create my own table to hold the blob data. But I don't know how to go from a File Browse object directly to that table.

      I just started in APEX 4.2.

      In this case the data is temporary, I don't need to retain these files in Oracle.
        • 1. Re: Set Session Id in PL/SQL
          Ramesh P, Oracle APEX Developer
          In your procedure have this code and it will work.

          declare
          v_workspace_id NUMBER;
          BEGIN
          SELECT workspace_id
          INTO v_workspace_id
          FROM apex_workspaces
          WHERE workspace = 'HCD';
          apex_util.set_security_group_id(p_security_group_id => v_workspace_id);


          //your code here
          select blob_content,filename,mime_type,dad_charset
          into l_blob_data,l_orig_filename,l_mime_type,l_dad_charset
          from wwv_flow_files;

          END;

          Thanks,
          Ramesh P,

          If its helpfule mark as helpful and if it answered you question mark it as answered.
          • 2. Re: Set Session Id in PL/SQL
            560577
            HarryFerrari wrote:
            I know I can create my own table to hold the blob data. But I don't know how to go from a File Browse object directly to that table.
            This is how. I like this approach (in your own table) so that it's not living in the big bucket of files in the delivered Apex table.
            http://awads.net/wp/2012/03/12/how-to-download-blob-content-as-a-file-using-oracle-application-express/