Oracle V$ table usage in shell [message #120617] |
Fri, 20 May 2005 16:27 |
kousikb
Messages: 2 Registered: May 2005
|
Junior Member |
|
|
Hi All,
I am writing a shell script in which a sql block will be executed. I want to use oracle v$ tables like v$session in the sql block , but unix is taking $ as unix variable indiactor. How can I escape that $ for Unix?
I read "Oracle for UNIX FAQ" , specially the subsection "How does one SELECT a value from a table into a Unix variable?" , but still I am not able to get the solution.
A very simple form of my script looks like:
---------
sqlplus -s system/manager@test8i <<EOF | read RETVAL
set echo off heading off feedback off pagesize 0
WHENEVER SQLERROR EXIT 1
select count(*) from v$session;
EOF
if [ "$RETVAL" > "0" ]; then
echo greater than zero
else
echo less than zero
fi
echo "retval is [$RETVAL] "
-----------
Please help.
~
|
|
|
|