HiveBrain v1.2.0
Get Started
← Back to all entries
snippetModerate

How can I determine if Oracle is installed on Microsoft Windows or Unix using SQL?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canunixsqlmicrosoftusingdeterminehowwindowsoracleinstalled

Problem

Is there a view in which I can check it? I need to create a script using the SUBSTR function by / (Linux) or \ (Windows).

SUBSTR('anything', 1, INSTR('anything', '/', 1, 1)) -- Linux

SUBSTR('anything', 1, INSTR('anything', '\\', 1, 1)) -- Windows

Solution

SQL> select platform_name from v$database;

PLATFORM_NAME
--------------------------------------------------------------------------------
Linux x86 64-bit


To answer your original problem:

SQL> select sys_context('userenv', 'platform_slash') from dual;

SYS_CONTEXT('USERENV','PLATFORM_SLASH')
--------------------------------------------------------------------------------
/


SYS_CONTEXT

PLATFORM_SLASH

The slash character that is used as the file path delimiter for your
platform.

Code Snippets

SQL> select platform_name from v$database;

PLATFORM_NAME
--------------------------------------------------------------------------------
Linux x86 64-bit
SQL> select sys_context('userenv', 'platform_slash') from dual;

SYS_CONTEXT('USERENV','PLATFORM_SLASH')
--------------------------------------------------------------------------------
/

Context

StackExchange Database Administrators Q#332683, answer score: 18

Revisions (0)

No revisions yet.