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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Accessing UNIX Environment Variables in PL/SQL

Re: Accessing UNIX Environment Variables in PL/SQL

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Fri, 16 Oct 1998 13:48:59 +0200
Message-ID: <707buv$miq$1@hermes.is.co.za>


Donald J. Merical wrote in message <362614BE.3089_at_ornl.gov>...
>
>How can you access UNIX environment variables and store them into a
>PL/SQL variable?

Assuming that you're running or activating the PL/SQL procedure from a Unix shell script, it should be fairly straight forward as you can use Unix variables like this:
--
# !/bin/sh
# sample script (untested)
NAME=$1
SURNAME=$2 echo "
EXECUTE mypackage.adddata('$NAME','$SURNAME'); EXIT;
        " > /tmp/~temp$$.sql

sqlplus scott/tiger @/tmp/~temp$$.sql

rm /tmp/~temp$$.sql
--

This is a very simple example I know, but it raises all kinds of posibilities. For example, you can a table containing Unix variables. Something like this:
columns: unixpid, unixparam, unixvalue

And then populate this table in the Unix script with the current UNIX process id and env data (fairly simple using grep, awk etc.)

The stored proc can then obtain the current Unix PID from the v$session table for that session and access any of the Unix variables.

When the Unix script terminates, it can delete it's entries from the table.

regards,
Billy Received on Fri Oct 16 1998 - 06:48:59 CDT

Original text of this message

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