Home » Infrastructure » Unix » Oracle V$ table usage in shell
Oracle V$ table usage in shell [message #120617] Fri, 20 May 2005 16:27 Go to next message
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.




~

Re: Oracle V$ table usage in shell [message #120618 is a reply to message #120617] Fri, 20 May 2005 16:34 Go to previous message
kousikb
Messages: 2
Registered: May 2005
Junior Member
ok .....I got it .... escape by \...
Previous Topic: Oracle 9i 32 bit upgrade to Oracle 10g 64 bit
Next Topic: HELP!!Unix variables not visible under Oracle!!!
Goto Forum:
  


Current Time: Fri Mar 29 06:57:25 CDT 2024