2

I am using the following simple UNIX script to assign the output to a variable.

count=`sqlplus -s ${DB_USER}/${DB_PASS}@${DB_INST} << END
        SELECT COUNT(column_name) from table_name;
END`

echo $count

But I am getting the following error on executing:

SP2-0042: unknown command "END" - rest of line ignored.

count=`sqlplus -s ${DB_USER}/${DB_PASS}@${DB_INST} << END

When I tried to execute the above statement in putty, it was saying as "bad substitution"

So I am using UNIX script to assign the output to a variable.

count=sqlplus DB_USER/DB_PASS << END SELECT VERSION_NUMBER from GA_PERIODIC_REFRESH where MODULE_NAME in 'RoaminfoService'; exit; END echo $count

1 Answer 1

4

You need exit also:

count=`sqlplus -s ${DB_USER}/${DB_PASS}@${DB_INST} <<END
set pages 0 echo off feed off
SELECT COUNT(column_name)
exit;
END`
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.