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

Home -> Community -> Usenet -> c.d.o.tools -> return value from sqlplus called from korn shell script

return value from sqlplus called from korn shell script

From: <chuw_at_my-deja.com>
Date: Fri, 27 Oct 2000 16:23:59 GMT
Message-ID: <8tca6m$r7t$1@nnrp1.deja.com>

Hello,

    I'm trying to call a sql command giving two inputs and expecting an output value. But I receive an syntax error and cannot figure it out. The sqlplus command works when I don't try to capture the return value result . So if run

sqlplus -s joe/joe @/test/run_will.sql "$OUTFILEDIR" "$outfile" it works fine. but if add result= I get the funny errors.

my shell script

#! /bin/ksh

OUTFILEDIR="/test"
outfile="test.txt"

result=`sqlplus -s joe/joe @/test/run_will.sql "$OUTFILEDIR"  "$outfile"<<EOF
EOF
`

   if [ $? -eq 0 ]
   then

      if [ "${result}" -eq 0 ] ;then
        print "Successful load ! "
      else
        print "*****************************************************"
        print "Failed at loading file ! "
        print "****************************************************"
        exit 1
      fi
   else
      print "*****************************************************"
      print "Fatal error from sqlplus ! "
      print "*****************************************************"
   fi

my run_will sql code is

Declare

   val number(1) := 0;
Begin

   val := willfunc('&&1','&&2');
End;
/

/test/>back4.ksh

back4.ksh[12]: old 4: val := willfunc('&&1','&&2');^Jnew 4: val := willfunc('/test','test.txt');^J^JPL/SQL procedure successfully completed.: syntax error



Failed at loading file !

thanks

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Oct 27 2000 - 11:23:59 CDT

Original text of this message

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