Oracle Apex - 读取上传的txt文件的内容

时间:2015-10-21 09:15:08

标签: oracle upload oracle-apex

我正在尝试阅读使用页面项目文件浏览器上传的文本文件的内容,但我无法弄清楚如何获取文件内容。

我不需要将它推入桌子或任何东西,我只想在文本区域中对其进行字符串表示。或者存储到变量中以便我可以处理。

道歉,如果有的话。我尝试了几种方法,但我不确定,我能否以某种方式使用WWV_FLOW_FILE获取内容?

我见过的唯一解决方案是使用向导区域和数据映射/验证面包屑,这不是我需要的。

2 个答案:

答案 0 :(得分:0)

您可以在WWV_FLOW_FILE内找到上传的文件作为BLOB。如果你只想展示它,让我们说一个名为P1_some_text_field的文本字段,你可以在你上传的页面上简单地添加这样的程序:

BEGIN
  SELECT utl_raw.cast_to_varchar2(dbms_lob.substr(blob_content))
  INTO :P1_some_text_field
  FROM wwv_flow_files
  WHERE created_on =
    (SELECT MAX(created_on) FROM wwv_flow_files WHERE CREATED_BY = :APP_USER
    );
END;

请注意,这最多将检索文件的第32767个字符。

答案 1 :(得分:0)

When I upload the file to WWV_FLOW_FILES, I then used a pl/sql statement to get the ID of the last file uploaded by the user and send the ID through another pl/sql statement which launches a powershell script on the server to download the file. The file is then processed on the server.