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 > Problem with select returning 0 rows in an IN clause

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-02-03, 05:16
afloom afloom is offline
Registered User
 
Join Date: Oct 2003
Posts: 3
Problem with select returning 0 rows in an IN clause

Hi,

I have the following prepared statement:

UPDATE AAA_TABLE SET BBB_FIELD = ? WHERE CCC_FIELD IN (SELECT DISTINCT CCC_FIELD FROM AAA_TABLE WHERE DDD_FIELD IS NULL FETCH FIRST ? ROWS ONLY)

My problem is that the select sometimes returns 0 rows, which causes an error. Is this how DB2 works and is there a way around that problem?

My environment:
Windows 2000 SP3
WebSphere AS v4.0.4
Java 1.3.1
DB2 v7 (don't know patches etc.)
DB2 JDBC (don't know any version details)

I'm sorry I can't specify the versions in more details. If the problem could be due to a specific version, I could look into this.

Thanks in advance!

Last edited by afloom; 10-02-03 at 05:20.
Reply With Quote
  #2 (permalink)  
Old 10-02-03, 05:18
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Hi,

I am not 100% sure, but if I remember right update with fetch first x rows only can be done only with db2 version 8.

Hope this helps,
Grofaty
Reply With Quote
  #3 (permalink)  
Old 10-02-03, 05:20
afloom afloom is offline
Registered User
 
Join Date: Oct 2003
Posts: 3
But the fetch first x rows is for the select. Could it still be a problem in v7?
Reply With Quote
  #4 (permalink)  
Old 10-02-03, 05:45
afloom afloom is offline
Registered User
 
Join Date: Oct 2003
Posts: 3
Quote:
Originally posted by grofaty
Hi,

I am not 100% sure, but if I remember right update with fetch first x rows only can be done only with db2 version 8.

Hope this helps,
Grofaty
Grofaty,

I seems as you were absolutely correct. Removing the fetch first part it works! Lots of thanks!!!!

Regards
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