Hi All,
I need to fetch the values stored in tables residing in Oracle database into shell script variables. Below is the code snippet I am using to achieve the same
CNT=`$ORACLE_HOME/bin/sqlplus -s $CONNSTRING <<EOF
SELECT records_processed FROM table1;
exit
EOF`
echo $CNT
Answer to above select statement is 40. However, the result of above echo is RECORDS_PROCESSED -----------------40. I am not able to get rid of this extra bit (RECORDS_PROCESSED -----------------)coming everytime in echo. I have tried using cut, but the result of the select statement can vary from time to time. So cannot define a definite limit to cut exactly till which position. Please suggest a way to fetch just value 40 in the shell variable and also the reason why it displayes the table's column name along with its value.
Many Thanks.