Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: urgent help needed!! - connecting to db through unix script
WayneB wrote:
>
> Hi all,
>
> This is someting I need to solve as soon as possible.
>
> From unix shell script I need to
>
> 1. Connect to a database
> 2. Retrieve values from a table
> 3. For each value, assign to an environment variable.
> 4. Close connection
>
> When the scripts finishes, I need to be able to see the environment
> variables
> by doing 'set' or 'env' (doesn't matter which one just so long as I can see
> the values
> from the command prompt).
>
> Thanks in advance.
> Wayne Leone
FIRST write something like this and save it to a file (abc.sql for example).
sqlplus user/password<<EOF
select commands required;
exit;
EOF
SECOND write a shell program that executes the first file and greps or
awks for the variables you require and do the set or export in this
program. You could spool off the stuff from step 1 and put it in a file
if that's easier for you to work with. Should take about 10 minutes to
whip up!!
This is only 1 approach, you could do it all from program one with a little more work but hey, it's free advice. Received on Mon Mar 16 1998 - 00:00:00 CST
![]() |
![]() |