[comp.databases] Accessing $VARs from ORACLE*FORMS

nigel@cnw01.storesys.coles.oz.au (Nigel Harwood) (05/08/91)

Sorry if this is a FAQ.

Is there any way to access UNIX environmental variables from within
an Oracle FORM ?

Our Oracle consultant says the only way is via a user exit but this seems
like a great deal of effort for something I would have expected to be
part of standard FORMS.

Anybody know any other ways ?

-- 
<<<<<<<<<<<<<<<<<<<<<<<<<  Nigel Harwood  >>>>>>>>>>>>>>>>>>>>>>>>>>>
<< Post:  Coles Myer Ltd, PO Box 2000 Tooronga 3146, Australia     >>
<< Phone: +61 3 829 6090  E-mail: nigel@cnw01.storesys.coles.oz.au >>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

jcs@hare.cdc.com (Jon Stonecash) (05/10/91)

In article <1251@cnw01.storesys.coles.oz.au> nigel@cnw01.storesys.coles.oz.au (Nigel Harwood) writes:
>
>Is there any way to access UNIX environmental variables from within
>an Oracle FORM ?
>
>Our Oracle consultant says the only way is via a user exit but this seems
>like a great deal of effort for something I would have expected to be
>part of standard FORMS.
>
>Anybody know any other ways ?
>
The simplest way that comes to mind is to use a here document in a shell
script to call SQLPLUS to insert the desired environment values into a
table in the data base.  The table might look like:

     create table environment (
           env_name char(30) not null,
           env_value char(100));

The SQLPLUS shell script might contain something like:

     sqlplus user/password <<!
          delete environment;
          insert into environment (env_name, env_value)
                values ("env-name-1",$env_name_1);
          ....
          insert into environment (env_name, env_value)
                values ("env_name_n",$env_name_n); 
     !

Naturally, you would have to decide upfront what environment variables
were of interest to the application.  The form could invoke the shell
script with a #HOST command if more timely values were needed, although
I do not see a need for this right off.  More likely, the table could be 
updated just before the forms application started.

Jon Stonecash
Production Data Management Technology Center
Control Data Corporation