Re: Calling Operating system command from Database

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: Sun, 10 Aug 2003 11:05:55 +0000
Message-ID: <3222150.1060513555_at_dbforums.com>


Originally posted by Adnan
> I want to read a file list in a directory from a database procedure. I
> m using Oracle 9i Release 2. How to do??? I don't want to user
> external procedures. I know it can be done through java stored
> procedure. Any other solution like a single command......Java code is
> still ok...
>
> Regards,
>
> Adnan

There isn't a prebuilt "single command" solution. You have to write a java stored procedure and a PLSQL wrapper procedure.

Read java docs and Look at list() or listFiles() functions in "File" interface in "java.io" API. Goto http://tahiti.oracle.com for Oracle docs.

Hint:
import java.io.*;
public class foo {

   public static String getFileList (String dirname) {

      ....
      File dir = new File(dirname);
      String[] entries = dir.list();
      ...

   }
}

Regards
/Rauf Sarwar

--
Posted via http://dbforums.com
Received on Sun Aug 10 2003 - 13:05:55 CEST

Original text of this message