Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: UTL_FILE on multiple platforms
mobiGeek wrote:
> I need to have my PL/SQL package run on both Windows and Solaris. In
> my code, I am using utl_file to log debugging info.
>
> Currently my code looks like:
>
> v_dbg_file := utl_file.FOPEN( 'c:\tmp',
> 'utl_file_SetSynchScripts.txt', 'a' );
>
> Is there a generic way to have FOPEN create its file without
> specifying the directory?
>
Don't know.
>
> Failing that, is there a way that I can programmatically determine the
> OS (or the machine name) on which the code is running so I can do
> something like:
> IF [running_on_windows] THEN
> v_my_utl_directory := 'c:\tmp';
> ELSE
> v_my_utl_directory := '/tmp';
> END IF;
>
I'm sure that there's a more elegant way to do this, but one approach that immediately comes to mind is to check the value of a particular initialization parameter. For example, check the value of "control_files"
(i.e. select value from v$parameter where name = 'control_files';,
assuming
that you have the proper privileges). If the values contain a Unix-type
file spec, then your OS is Unix. You get the idea.
Bye,
TG
>
> Thanks in advance,
> greg_fenton.
Received on Fri Feb 28 2003 - 15:27:53 CST
![]() |
![]() |