Unanswered: Unix and db2 where condition issue(new line)
I am extracting a column value(DESCRIPTION) from one table and passing it to another db2 statement in a shell code to fetch some value(ID) but the value when passed in where condition is taking as newline+value.
Please find the out put when executed:
+ echo description is :::: $DESCRIPTION
description is :::: AAAA
Though it is not giving any line here but the above description when passed in below code:
ID_LIST=`db2 -x "select distinct SITE_ID from TABLEA where REGION='$DESCRIPTION' for fetch only with ur"`
is giving the below output
+ + db2 -x select distinct SITE_ID from TABLEA where REGION='
AAAA' and report_dt='31/03/2012' for fetch only with ur
'AAAA' is replaced as
A new line in the value is creating a issue which results in now data from the table.
Could you give me a reason and solution for the problem? Thanks in Advance