I am using the below code to get a numeric value from oracle to unix variable:
BD_RC_CNT=`sqlplus -s ${WMD_DM_CONNECT} <<EOF
set heading off
set pagesize 0
Select count(*)
from wmd_bad_data
where proc_id = ${PROC_ID}
and file_id = ${FILE_ID}
and file_dt = to_date(${DATADATE},'yyyymmdd');
exit
EOF`
I issued echo command and output is below:
$ echo $BD_RC_CNT
6
How ever when i tried to find the length of the variable it shows 3 instead of 1:
$ echo `expr length "$BD_RC_CNT"`
3
Can somebody please help in removing the extra characters ?
Thanks in advance!
Hi
try this: mind the spaces: "read|space|BD_RC_CNT|space|<|space|<( etc..."
read BD_RC_CNT < <(sqlplus -s ${WMD_DM_CONNECT} <<EOF
set heading off
set pagesize 0
Select count(*)
from wmd_bad_data
where proc_id = ${PROC_ID}
and file_id = ${FILE_ID}
and file_dt = to_date(${DATADATE},'yyyymmdd');
exit
EOF)