Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: unix/sqlplus host variables

Re: unix/sqlplus host variables

From: Mark Styles <news_at_lambic.co.uk>
Date: Wed, 07 Nov 2001 18:56:42 GMT
Message-ID: <6q0jut8j43r0emv0aipgmiibf84i48qsr4@4ax.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US