Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: unix/sqlplus host variables
On Wed, 7 Nov 2001 19:43:32 +0100, "ab" <a_at_b.com> wrote:
>I would like to get in a unix variable the result of a query in a ksh
>script.
>
>The ksh script i wrote is like (which doesn't work)
>
>#! /bin/ksh
>sqlplus $user/$password << EOF
>select count(*) into :nRes from Table
>EOF
>echo $nRes
>
>I didn't find any way to get the result of my query without using a
>temporary file or the instruction : var=`sqlplus ...`
What's wrong with doing it that way?
var=`sqlplus -s $user/$password << EOF
set head off feed off pages 0
SELECT COUNT(*) FROM table;
exit
EOF`
echo $var
Received on Wed Nov 07 2001 - 12:56:42 CST
![]() |
![]() |