Home » SQL & PL/SQL » SQL & PL/SQL » Getting the UNIX file size from PLSQL
Getting the UNIX file size from PLSQL [message #205214] Thu, 23 November 2006 23:03 Go to next message
Aju
Messages: 94
Registered: October 2004
Member
Hi

I have got a unique requirement. I will be provided with a directory name with the entire UNIX path. From the directory name I will have to collect all the subdirectory name. Within each subdirctory there will be only 1 file. I need to extract each of these filenames, its creation date and push all these information into a UNIX file.

Can anyone please help me on this.
I tried to use the prorgam as in the link below but it shows Java is not installed.
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:439619916584

SQL> create or replace
2 and compile java source named "DirList"
3 as
4 import java.io.*;
5 import java.sql.*;
6
7 public class DirList
8 {
9 public static void getList(String directory)
10 throws SQLException
11 {
12 File path = new File( directory );
13 String[] list = path.list();
14 String element;
15
16 for(int i = 0; i < list.length; i++)
17 {
18 element = list[i];
19 #sql { INSERT INTO DIR_LIST (FILENAME)
20 VALUES (:element) };
21 }
22 }
23
24 }
25 /
create or replace
*
ERROR at line 1:
ORA-29538: Java not installed

Thanks


Here is the information on my database
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
TNS for Solaris: Version 10.2.0.1.0 - Production
Re: Getting the UNIX file size from PLSQL [message #205239 is a reply to message #205214] Fri, 24 November 2006 00:52 Go to previous message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
In 10g it is possible to execute an operating system command using the DBMS_SCHEDULER package.

Ross Leishman
Previous Topic: connect by prior, how to get all the level even started from middle
Next Topic: Rownum inside 'Exists' subquery
Goto Forum:
  


Current Time: Thu Dec 08 08:44:24 CST 2016

Total time taken to generate the page: 0.17460 seconds