Hi,
I need to get a variable HMAX_TBL_ID and then use it in second select query. The first select statement returns few leading white spaces for ex : 12345
so when I run the script HMAX_TBL_ID does not return the "12345" , it returns blank.
Please let me know what I am missing.
HMAX_TBL_ID=`psql -U ${PG_USER} -h ${PG_HOST} -d ${PG_DB} -p ${PG_PASS} -t -c "select stp_ctr_fetch_module_tbl_id('ATTRIB', 'GET')"` | sed -e 's/^[ \t]*//'
echo -e "This is max table id in ${HMAX_TBL_ID} "
if [ $? -ne 0 ]
then
echo -e " Error while getting the maximun table id processed"
fi
psql -U ${PG_USER} -h ${PG_HOST} -d ${PG_DB} -p ${PG_PASS} -t -c "select distinct tbl_id from tbl_ctr_module_tbl where tbl_id between ${LAST_PROCESSED_TABLEID} and ${HMAX_TBL_ID}" | sed '/^$/d' > ${TBL_ID_FILE}