Unix and db2 where condition issue(new line)

Hi

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
'
AAAA'

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

Not to use too many tools for a simple solution, just write your query in SQL string language in the first query and just send it to the second SQL client to run. The results are viewable, predictable and reliable (robust), unless someone puts a lf in the db string, and even then, there are tools to remove it, like substr() and index(), as I recall offhand. You just need options or sh filtering to remove headers and the like. Sometimes there are functions to reparse a generated string in the first session, like to access a generated table. Then, there are views or derived tables of unions, so many tables can be one.