Issue with the script

#!/bin/ksh
set -x
SQLSTR="LOGIN/PASSWORD"

sqlplus -s ${SQLSTR} @<<EOF 
set pagesize 0 feedback off verify off heading off echo off;
UPDATE TABLE NAME
SET VALUE = VALUE + 1
where VALUE2 = 'ABCDE';
exit;
COMMIT;
EOF

i am not able to update the column and not able to exit from sqlplus.

help !!! thanks:)

Hi.

What is @ for? (@<< EOF)

Why do you exit before you commit (not that it should matter?)?

And what do you mean by "not able to exit from SQL*Plus?

that was a typing error .

once the table is updated i'm not able to exit.

---------- Post updated at 07:07 PM ---------- Previous update was at 07:04 PM ----------

#!/bin/ksh
set -x

#### Connecting to database 
SQLSTR="loginid/pass"
sqlplus -s ${SQLSTR}<<END
set pagesize 0 feedback off verify off heading off echo off
UPDATE table
SET x_col = x_col + 1
where c_col = 'abcde';
exit;
EOF

i am not able to execute !! thanks

I'm a bit confused now. Execute or exit? You mentioned both.

For exit can you say from what you want to exit? The SQL*Plus will exit at the closing EOF, so I'm not sure what you mean.

(I presume <<END is another typing mistake. Please use CODE-TAGS and cut and paste your code if possible).

Not able to execute what? You said "once the record is updated..." so I presume the script itself is executable.

I hope you realize this will show a process in your process table showing the username and password of the user you use to connect to the database

# ps -ef

<some uid> <some pid> <some ppid> .............. sqlplus -s <username>/<password>

Better use something like:

sqlplus -s /nolog<<END
connect ${SQLSTR}
etc

If you started your 'here statement' with 'END' you should probably end it with 'END'.
Otherwise, begin and end it with 'EOF':

      RESULT=`sqlplus -s "${USER}/${PASS}@${DB}" <<EOF > mysql.log
      WHENEVER SQLERROR EXIT 1;
      SET ECHO OFF NEWPAGE 0 SPACE 0 PAGESIZE 0 FEED OFF HEAD OFF
      UPDATE table
         SET x_col = x_col + 1
       WHERE c_col = 'abcde'
      ;
      EXIT
EOF`

rc=$?
if [[ $rc -ne 0 ]]; then
   echo "Update failed"
   exit $rc
fi

Please try to follow the entire post before contributing.

Wow! Thought I was answering the original poster's question.