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

Home -> Community -> Usenet -> c.d.o.server -> Re: - determine Operating system using pl/sql??

Re: - determine Operating system using pl/sql??

From: <Kenneth>
Date: Wed, 28 Apr 2004 09:31:11 GMT
Message-ID: <408f7723.2492143@news.inet.tele.dk>


Here's another hint :

Query DBA_DATA_FILES or V$DBFILE :

If the filename column starts with a letter followed by a ':' and a backslash, it is Win32. Otherwise, it is Unix (if these 2 O/S' are the only options!)

Create or replace function IsWin32 return boolean is
  Dummy binary_integer;
begin
  select count(*)
    into Dummy
   from dba_data_files
 where file_name like '_:\%';
  return Dummy > 0;
end IsWin32;

Note that even though Oracle 8i and forward on Win32 accepts unix-like filename-notation in file-related commands, it is converted and recorded in the DD in WIN32-format:

SQL>select file_name from dba_data_files where tablespace_name = 'USERS'; FILE_NAME



C:\ORACLE\ORADATA\GAF\USERS01.DBF SQL>alter tablespace users add datafile
'/oracle/oradata/gaf/users_002.dbf' size 16m;

SQL> select file_name from dba_data_files where tablespace_name = 'USERS'; FILE_NAME



C:\ORACLE\ORADATA\GAF\USERS01.DBF
C:\ORACLE\ORADATA\GAF\USERS_002.DBF

On Wed, 28 Apr 2004 08:59:34 +0200, Herman de Boer <h.de.boer_at_YouCanGuessThis.com> wrote:

>Andre wrote:
>
>> Hello all,
>>
>> I've written a pl/sql package. Within this package I want to know if
>> the Operating system on which the Database is running is UNIX or
>> Windows-based.
>>
>> Is there a way to do this?
>>
>> regards,
>> Anneke
>> The Netherlands
>
>Hello Anneke,
>
>what about a simple:
>
>select dbms_utility.port_version from dual;
>
>
>
>
>--
>Kind Regards,
>
>Herman de Boer
>sr. Consultant, IT Consultancy group bv (itcg.nl)
Received on Wed Apr 28 2004 - 04:31:11 CDT

Original text of this message

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