Below script works perfectly fine from command line, but when I run through browser I am not getting anything inside my $dt. Because of this its always going inside failure scenario. My procedure is going to return either Success / Failed output. Can anybody tell me where I am messing up.

Code: ( text )

#!/usr/bin/ksh

if [ $REQUEST_METHOD == "POST" ]
then
        QUERY_STRING=`line <&0`
fi

export TEMP_STRING=$QUERY_STRING

User_ID=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) {if($i ~ /userid/) {print $i;} } }' | cut -f2 -d'='`

SCRN_Token=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) { if($i ~ /scrntoken/) {print $i;} } }' | cut -f2 -d'='`

SQLPLUS=`which sqlplus`
FMUSER=username
FMPASS=password
FMSID=orasid

REMOTE_ADDR=`env | grep "REMOTE_ADDR" | cut -f2 -d'='`
NewToken="${REMOTE_ADDR}${User_ID}"

dt=`$SQLPLUS -s $FMUSER/$FMPASS@$FMSID <<EOF
set head off
set pagesize 0
set feedback off
set serveroutput on feedback off
exec validate_fm_user('$SCRN_Token', '$NewToken')
quit
EOF`

echo dt is -$dt-

if [ "$dt" != "Success" ]
then
#some error action
exit 0
fi

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Hey There

I don't see in the script where the Oracle environment is being sourced into the script. Do you run this on the command line as Oracle when it works?
Probably, if you added a line near that top, like:
. /home/oracle/.profile

The space between the dot and the profile is important. That might do it for you.

Hope that helps :)

, Mike

This article has been dead for over six months. Start a new discussion instead.