Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Suggestions - DOS Command - Return value

Re: Suggestions - DOS Command - Return value

From: T. Schmidt <t.schmidt_at_rmv.spm.semantica.nl>
Date: Tue, 1 Oct 2002 16:15:30 +0200
Message-ID: <ancacv$kgm$1@reader10.wxs.nl>


You may want to take a look at the PL/SQL package PL/File. PL/File offers advanced file-, directory- and zip file functionality from within Oracle. Through PL/SQL these functions can be called in any Oracle application. It makes no difference if these files are located on the database machine or other machines, PL/File guarantees platform independence.

Here's an example :

Listing a directory
This script shows the usage of the PL/File dir list function and general filelist functions. The example shows the contents of a directory.

declare
 machine varchar2(100) := 'LINUX';
 service varchar2(100) := 'service_1';
 password varchar2(100) := 'THEPASSWORD';  location varchar2(100) := '/tmp';
 nh plfile.node_type;
 fh plfile.file_type;
 flh plfile.filelist_type;
 i number;
begin
--

 if not plfile.file_isdirectory( fh )
 then
  dbms_output.put_line( location || ' is not a directory' );  else

  --
  -- Obtain a handle to a filelist
  --

  flh := plfile.dir_list( fh );
  --
  -- Display the items in the filelist
  --
  dbms_output.put_line( 'The directory contains ' ||
                                 to_char( plfile.filelist_count( flh ) ) ||
                                 ' item(s)'
                               );

  i := 1;
  while ( i <= plfile.filelist_count( flh ) )   loop
   dbms_output.put_line( plfile.filelist_item( flh, i ) );    i := i + 1;
  end loop;
  --
  -- Remove the obtained filelist handle
  --

  plfile.filelist_clear( flh );
 end if;
--

exception
 when others
 then
  dbms_output.put_line( 'SQLCODE = ' || SQLCODE );   dbms_output.put_line( 'SQLERRM = ' || SQLERRM ); end;

More information, examples and trial download can be found at www.plfile.com

Kind regards,
--TS

"bigKED" <tme2slp_at_yahoo.com> wrote in message news:fX3m9.49594$Fw2.1207285_at_twister.austin.rr.com...

> I'm using Oracle 9i on Windows 2000 Professional:
>
> I need to execute a command (DIR) and insert the number of files in the
> directory to a field.  At some point, the file number will not grow, which
I
> will  have another field set to 'Done'.  (Set to 'Done' by end user.)
>
> I take it that once the file count is done, I will set a trigger on the
> 'Done' field, so the DOS command or whatever command I use does not
execute
> in the future.  And the highest file count will be inserted to database.
>
> My questions are 'Do I use SQL to execute the DOS command?'  And have it
> executed each time the user views the field?  Unless it is set to 'Done'
> which in that case will give the highest file count.  Or since I plan to
use
> the web to add/view data to the database, use something like ASP to do all
> the work?
>
> Hope you can follow my logic.  Remember, that I'm new, not a student, just
> trying to learn Oracle 9i.
>
> Thanks..
>
> Ked
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 20-09-02
Received on Tue Oct 01 2002 - 09:15:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US