views:

281

answers:

2

Is it possible to determine where Oracle is installed using pure PL/SQL?

Use case: In order to call an external C library, I need to know its exact path (for the create library call). My DLL will reside in Oracle's BIN directory, but I can't hard-code the path of the DB installation in my scripts...

+1  A: 

Check the last postings on this page:

http://www.mydatabasesupport.com/forums/database-discussions/34933-query-oracle_home-3.html

Bruno Rothgiesser
Thanks, I used the proposed approach to fetch the path of the `DBMS_SUMADV_LIB` library, which works fine on 10g as well. // Could you edit your answer and actually list the approaches to help other people who find this question?
Jens Bannmann
+3  A: 
DECLARE
 RetVal VARCHAR2(100);
BEGIN
  dbms_system.get_env('ORACLE_HOME', RetVal);
  dbms_output.put_line(RetVal);
END;

NOTE: It is likely you that you will not have permission to this package by default.

Brian
Unfortunately, on my database, `DBMS_SYSTEM` is not installed.
Jens Bannmann
Have you considered using a DIRECTORY?CREATE OR REPLACE DIRECTORY APP_ORACLE_HOME AS '/u01/oracle/10.1.2';
Brian