If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > If no record found then .. What's default output of ....

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-09, 01:55
nitingautam nitingautam is offline
Registered User
 
Join Date: Nov 2008
Location: Delhi, India
Posts: 15
Question 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
Reply With Quote
  #2 (permalink)  
Old 01-05-09, 04:04
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On