tags:

views:

331

answers:

4

I get the following error when running an sqr report on DB2:

SQL0100W - No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table.  SQLSTATE=02000

The sql in question runs correctly when I paste it into RapidSQL, replacing the parameters. The sql in question is an insert-select. No rows are returned by the select, and this is fine... I expect the report to be blank for my parameters.

Any idea how I can get around this?

+1  A: 

DB2 returns always an SQL0100 warning (this is a warning, not an error - errors would have negative values) when no rows are returned. That's the way it is. I don't know peoplesoft at all - so I can't give you any pointers with that. Back when I was programming for DB2 we ignored those SQL0100 warnings.

bernhardrusch
Unfortunately I have no way to ignore this warning! My SQR terminates after printing out this message. Instead of generating a (blank) PDF report as it's supposed to. . . But thank you for the information!
Alterlife
too bad - this was one of the more annoying things of DB2.
bernhardrusch
+1  A: 

If SQR can't gracefully handle a NOT_FOUND SQL0100 return, then code a preliminary query to return a count of the number of rows that satisfy the conditions of the actual query. Check the result of the count in an if-then block in SQR to run the actual query if and only if the row count returned by the preceding query was not zero.

Fred Sobotka
+1  A: 

Turns out to be an environment setup issue. Got resolved with no change from me after a couple of builds....

Strange :-/

Alterlife
A: 

What was the environment issue? Why come back here and close the problem but not post any detail about the answer you found?

Mark
Unfortunately, I do not know what caused the error, or what fixed it. We have bi-weekly database builds. One build, the sqr was running to this error, the next week it was working again.
Alterlife