0

I have the code like this

v_use_xref_result=`sqlplus -s $UP <

   Select Code_Desc 
   From Code_Detail 
   Where Code='UXLOC' 
   and CODE_TYPE='UXRF'
       EOF`
 if [ "$v_use_xref_result" == "Y" ];  then
  echo "s"  else
  echo "n"
    fi

when I query the same in sql developer I am getting the result as Y for this query Select Code_Desc From Code_Detail Where Code='UXLOC' and CODE_TYPE='UXRF' the datatype of Code_Desc is varchar but I am unable to check in if condition. i am getting "n" as result for this script. can anyone help me how to check it in if condition.

1 Answer 1

1

As written, the heredoc syntax in your script doesn't seem to be correct. Try saying:

v_use_xref_result=$(sqlplus -s $UP <<EOF
   Select Code_Desc 
   From Code_Detail 
   Where Code='UXLOC' 
   and CODE_TYPE='UXRF'
EOF
)
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.