我想检索包含oracle表单和菜单的特定文件夹中的所有文件列表以及报告和一些txt文件…

您是否知道如何以ORACLE形式检索这些数据,并自动将它们插入到我的数据块中?

我使用oracle form 6.0.

解决方法

我沿着这些方向做了一些事:

为要列出的目录创建Oracle目录:

create or replace directory YOURDIR
  as '\path\to\your\directory';

构建临时表:

create global temporary table DIR_LIST
(
  FILENAME VARCHAR2(255),)
on commit preserve rows;
grant select,insert,update,delete on DIR_LIST to PUBLIC;

你需要一个java存储过程:

create or replace and compile java source named dirlist as
import java.io.*;
  import java.sql.*;
  import java.text.*;

  public class DirList
  {
  public static void getList(String directory)
                     throws SQLException
  {
      File dir = new File( directory );
      File[] files = dir.listFiles();
      File theFile;

      for(int i = 0; i < files.length; i++)
      {
          theFile = files[i];
          #sql { INSERT INTO DIR_LIST (FILENAME)
                 VALUES (:theName };
      }
  }

  }

和PL / SQL可调用过程来调用java:

CREATE OR REPLACE PROCEDURE get_dir_list(pi_directory IN VARCHAR2)
AS LANGUAGE JAVA
name 'DirList.getList(java.lang.String)';

最后,在表单中调用过程get_dir_list将使用目录中的文件填充表,然后可以将其读入表单块.

Java代码直接来自Tom Kyte的书(不记得是哪一本).

编辑:

实际上,所有代码都从这个AskTom thread中解脱出来.

dawei

【声明】:北京站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。