|
This should answer all the questions asked and I guess it's not important the result sets are returned in one Cursor...two cursers from one stored procedure would be fine (I think, I'm new at this). Version 5.1 Result set 1 will contain selected items from an item master file. Result set 2 will contain comments for each item selected in result set one. (One to many relationship) I guess the big question is how you use that first result set as input to the second select without building what we typically think of as a work file in QTEMP. What I'm learning, Vernon's example of running the first select within the second select (i.e. running it twice) is not a bad solution and is still very quick. I'm still not sure about returning two result sets from one stored procedure, but that's something I can run and test. >>From: rob@dekko.com >>Do have a sample of the data you want read, and how you want it presented? >>Rob Berendt >>From: Vernon Hamberg <vhamberg@attbi.com> >>Dave >>Do the 2 result sets have the same column structure? >>What version/release are you on? >>If the 2 sets have the same columns, then maybe >>select fields1 from files1 >>union >>with (select fields1 from files1) as alias select fileds2 from alias >>This'd run the first query twice, unfortunately. >>HTH >>Vern >>From: "Tyler, Matt" <mattt@wincofoods.com> >>Dave, >> Have you looked at join queries? They combine two or more tables >>together into one results set. >>Thank you, >>Matt Tyler >>Mattt@wincofoods.com >"Smith, Dave" <DSmith@tshsc.com> >We are trying to use the result set from one SQL Select statement as the >input to a second SQL Select statement. In the end, we want two result >sets that we can pass back in one Cursor. The first being the original >Select result set, the second being the result from the second SQL Select. >If anyone has a good example of an SQLRPGLE program that does something >like this, could you please post it on the list? >David Smith
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.