nothing to do, i already set all variables in # var initialization
but the following code returns: SP2-0042: unknown command "EOF" - rest of line ignored. SCHEDULE=`$ORACLE_HOME/bin/sqlplus -s $USR/[EMAIL PROTECTED] <<EOF set pagesize 0 feedback off verify off heading off echo off SELECT SCHEDULE FROM $TAB WHERE NOME_REPORT='$NOME_REPORT'; EOF` On 14 Ott, 12:58, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 14, 6:04 am, drain <[EMAIL PROTECTED]> wrote: > > > > > Hello, if i run this code in unix shell interactive mode: > > > # var initialization > > > SCHEDULE=`$ORACLE_HOME/bin/sqlplus $USR/[EMAIL PROTECTED] <<EOF > > set pagesize 0 feedback off verify off heading off echo off > > SELECT SCHEDULE FROM $TAB WHERE NOME_REPORT='$NOME_REPORT'; > > EOF` > > > then works fine, instead when i try same code inside shell script > > (.sh) i obtain these error: > > > SP2-0306: Invalid option. Usage: CONN[ECT] [logon] [AS {SYSDBA| > > SYSOPER}] where <logon> ::= <username>[/<password>][@<connect_string>] > > > how i can fix the script? > > > Thanks, > > Drain > > Where did you define USR and PWD? Since those variables are NOT set > you end up with /@$ORACLE_SID and thus the error message occurs. > You'll need to set USR and PWD BEFORE you try to execute this command > from within a script: > > #!/bin/ksh > > # var initialization > export USR=flapjack > export PWD=syrup > export NOME_REPORT=grahamcracker > > if [ "$ORACLE_SID" = "" ] > then > echo "Enter ORACLE_SID: \n" > read x > export ORACLE_SID=$x > fi > > SCHEDULE=`$ORACLE_HOME/bin/sqlplus /nolog <<EOF > connect $USR/[EMAIL PROTECTED] > set pagesize 0 feedback off verify off heading off echo off > SELECT SCHEDULE FROM $TAB WHERE NOME_REPORT='$NOME_REPORT'; > EOF > > Notice how sqlplus is called in this modified example; it keeps the > username and password from being visible to other users (a ps -ef will > display such information and the username and password are no longer > secure). > > David Fitzjarrell --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---