Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Folders in PL/SQL 1

Status
Not open for further replies.

fatcodeguy

Programmer
Feb 25, 2002
281
CA
Hi.

Does anyone know how to create folders in PL/SQL. I can't seem to find out how to do with the UTL_FILE Package.

Thanks
 
Hi. I've never heard of HOST built-in. Is there a specific procedure/function I can use, or is there documentation I can look up?

Thanks
 
Dima is correct. Use the HOST command as outlined in your Developer manual.
Code:
host('...your host command here...');

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant/Custom Forms & PL/SQL - Oracle 8i & 9i - Windows 2000
 
I checked out this function, but the problem is it runs the OS commands on my pc, and not the server PC. So I mapped a shared drive to the drive I actually want to create folders in. How do I call the host(); function from a PL/SQL procedure? Just like this... ?

Procedure create_folders(path varchar2)is
begin
host('mkdir'||path)
end;

This make sense?

Thanks again!
 
Yes, it works on where your Forms runs. I think you was misundersood, because in Oracle world Developer word normally stands for Oracle Developer toolset (Forms/Report), thus we expected related question. In your "pure-Oracle" case I may suggest to create simple Java class calling File.mkdir() and a wrapping PL/SQL procedure.

Regards, Dima
 
How would I do that (Any doc you can point me to would be great)? :)

Thanks a million!!
 
For wide understanding you may read
As a quick-and-dirty solution you may use the following:
Code:
create or replace and compile java source named "Dir"
as
  import java.io.*;
public class Dir extends Object {
  public static void Create(String dir) {
   File f = new File(dir);
   f.mkdir();
  }
}
/
create or replace procedure mkdir(p in varchar2)
as
language java
name 'Dir.Create(java.lang.String)';
/

You need a number of permissions both for creating these procedures and for running them. Unfortunately I can not provide the full list of requirements.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top