Home » SQL & PL/SQL » SQL & PL/SQL » Avoiding Hardcoding folder paths
Avoiding Hardcoding folder paths [message #180996] Thu, 06 July 2006 04:17 Go to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
There is a procedure which creates a file in a particular location in the remote server (Unix), at present the folder path is hardcoded,

Now the problem is the DB instance is being moved to another physical location, this may happen in future also, so what is the method to avoid hard coding the folder path in the procedure, what is a better work around for this one?

Any body who have come across the same and have a solution, kindly help me.

Thanks,

NN
Re: Avoiding Hardcoding folder paths [message #181007 is a reply to message #180996] Thu, 06 July 2006 04:54 Go to previous messageGo to next message
himang
Messages: 282
Registered: March 2005
Location: Bangalore
Senior Member

Why not pass the folder path as a parameter to the procedure? So whenever it changes, you just need to change it from calling application....

Regards
Himanshu
Re: Avoiding Hardcoding folder paths [message #181243 is a reply to message #180996] Fri, 07 July 2006 11:09 Go to previous messageGo to next message
stevebooth
Messages: 14
Registered: June 2006
Location: Pewaukee, WI
Junior Member
Or put it in a table...
icon6.gif  Re: Avoiding Hardcoding folder paths [message #186712 is a reply to message #180996] Wed, 09 August 2006 03:35 Go to previous message
janny
Messages: 5
Registered: August 2006
Junior Member
There is a possible way.
Create a directory as shown,

CREATE DIRECTORY --directory_name-- AS '--file_path';


This directory can details can be viewed through DBA_DIRECTORIES.

Now call the directory_name as followed,

utl_file.fopen(--directory_name--,--file_name--,--mode--);


Better to store the directory_name in a constant variable.
If there is any change in the file_path, just alter the directory with the new path. You can use,

CREATE OR REPLACE DIRECTORY --directory_name-- AS '--new_file_path--';


Try this...you will get things done.... Cool

Regards
Justin
Previous Topic: query on triggers... reply asap...
Next Topic: New install of 9i, unable to login
Goto Forum:
  


Current Time: Thu Dec 08 18:09:13 CST 2016

Total time taken to generate the page: 0.16101 seconds