Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2008
    Location
    Delhi, India
    Posts
    15

    Question Unanswered: If no record found then .. What's default output of ....

    I am using output of SQL Server subquery in DB2 query IN clause.
    I have a hurdle, if subquery found no record, then what it will return?

    Beacuse the output of this query will be input of IN clause in DB2 query, what if nothing is returned by the SQLServer query?



    Example:

    SQL Server SubQuery

    select CLNT_ID from CLNT_ACS where INTN_ID=12
    Output:
    1234

    DB2 Query
    SELECT CLNT_ID, CLNT_NM from CLNT WHERE CLNT_ID IN (1234) ORDER BY CLNT_NM

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    How do you tie both queries together? Do you use DB2's federated capabilities or do you build the DB2 query in some sort of application? In the first case (federation), you don't have to worry about this - just nest the query over the nickname into the IN predicate. In the second case, you have to detect this situation in your application and guarantee that DB2 will not see an empty IN-list in the query. Either you do not execute the query at all or you provide a dummy element.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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