× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Tomasz SkorÅa wrote:

I have following query:
<<SNIP query>>

When I call this statements in interactive SQL session
I get correct results - means all records which suite me.

But when I try call the same statement in SQLRPG program

DECLARE C1 CURSOR FOR <<SNIP query>>

I get only the rows where ILDCTO is equal "II"?

WHY? What is wrong? How to get all rows in second issue?


SELECT ILITM, ILLITM, ILMCU
FROM F4111
LEFT JOIN F57217C ON ILDOCO = ISBCT
and ILDCTO = 'II'

Since there is selection ON ILDCTO = 'II', why would any rows that do not meet that criteria appear? It would seem that if rows that do not meet that criteria appear for the STRSQL session, then there is a problem with the STRSQL results; i.e. perhaps then, not a problem with the RPG embedded SQL?

FWiW since the reader has no idea which columns come from which TABLE, it is best to provide correlation identifiers for the files and specify them as qualifiers on the column references; i.e. make it easier for others to assist, by providing the valuable details. Without the necessary details, too many *assumptions* have to be made about the scenario.

For lack of an ORDER BY, do not [incorrectly] conclude "wrong rows" are returned if the first block of returned rows are either different than or do not collate the same, when contrasting the results between the interactive request and the embedded request. Such a conclusion is folly, since an SQL result set has no predictable collation without an explicit ORDER BY to effect ordered rows [keyed across unique values].

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.