Getting OS info in PLSQL [message #206749] |
Fri, 01 December 2006 06:08 |
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
As per the solution from reisman...
In 10g it is possible to execute an operating system command using the DBMS_SCHEDULER package.
But I could not find any reference in the DBMS_SCHEDULER package where I can get the OS info into Oracle PLSQL.
Sorry that I missed the response of Relisman
Thanks
|
|
|
|
Re: Getting OS info in PLSQL [message #207025 is a reply to message #206749] |
Sun, 03 December 2006 23:19 |
Aju
Messages: 94 Registered: October 2004
|
Member |
|
|
Thanks Mahesh/Relisman for your time.
Sorry that I mis-interpreted the statement. What I mean is as below.
I understand, DBMS_Scheduler package executes a job according to the schedule you need. But as per Relisman this can execute operating system command. Please correct me if if i am wrong and guide how to acheive this.
In fact my requirement is to get all UNIX files attrbutes in a directory(filename, Creation_Date, filsize) into oracle (and may be I need to insert these values into a table)
In fact my team has done this through AB initio and Unix script but I am just wondering how to have this in PLSQL and exclude the Unix scripting
|
|
|
|