#!/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.
---------- 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
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