In one of the PL/SQL packages in our Oracle database, there's a global variable, g_file_path, that points to a location on the system where certain files will be stored:
create or replace
PACKAGE xyz_package
AS
...
g_file_path VARCHAR2 (80) := '/usr/tmp';
...
This variable is used in various UTL_FILE operations throughout the package.
Unfortunately, the path chosen is inadequate, and I need to figure out how to set a path dynamically depending on the environment where the database is running, e.g. so the path becomes /opt/ENVDB/xyz, where ENVDB changes depending on the env.
One idea is to emulate the behavior of the shell script:
>echo $XYZ_DB_TOP
That points to a suitable folder where the files can be stored. I can't think of a suitable PL/SQL function that emulates this behavior though. Any smart/simple solution to this problem? Any help is appreciated!