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

Home -> Community -> Usenet -> c.d.o.server -> Returning Oracle Variable to the Shell

Returning Oracle Variable to the Shell

From: [Franklyn] <franklynrizzo_at_today.com.au>
Date: Wed, 18 Apr 2001 14:15:48 +1000
Message-ID: <MPG.1547c0018d68443989680@news.cdn.telstra.com.au>

Greetings,

I'm trying to return a value from Oracle to a shell script. Here is an excerpt:

        SysLog "Executing  sqlplus -s User <$DB_USER>/<$ORAPASS>"
        sqlplus -s $DB_USER/$ORAPASS <<ORA_EOF > ${MAILFILE} 2>&1
            set echo on
            begin
               select to_date(run_date,'DD/MM/YYYY') + 1
               into ${RUN_DATE}
               from run_details;
            end;
            /
ORA_EOF
        code=$?
        SysLog "Got a run date of ${RUN_DATE} from Database"
        if [ $code -ne 0 ] ; then
            LogError "GetRunDate failed, code ($code)"
            exit 1
        fi


Problem: It does not populate the shell-variable $RUN_DATE from the database as I would expect. I want to get a value from the database and use it within my shell script. I'm missing something obvious here. (can this be done??).

Any help appreciated. Received on Tue Apr 17 2001 - 23:15:48 CDT

Original text of this message

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