Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2012
    Posts
    3

    Unanswered: 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
    Last edited by msp2244; 02-22-12 at 08:41.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •