Re: multiple result set
Posted in 2009
IDS version and platform? (ALWAYS POST THIS INFORMATION!) In general, you have it done correctly below. The multiple result-set idea works for me. Witness the following: CREATE PROCEDURE "art".mult_ret () returning char(150); define astring char(12); foreach select tabname into astring from systables return astring with resume; end foreach; foreach select ">>"||colname into astring from syscolumns return astring with resume; end foreach; end procedure; The procedure installs without error and runs correctly. The problem is that your two loops are returning different numbers of values. In your CREATE PROCEDURE/FUNCTION statement you must define the number and types of all returns. Your first loop returns three values and the second returns four values. One of them does not match the RETURNING clause in the CREATE.... statement. Since you don't show the entire source of the procedure, I don't know which. Art Art S. Kagel Oninit (www.oninit.com) IIUG Board of Directors (art@iiug.org) Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Oninit, the IIUG, nor any other organization with which I am associated either explicitly or implicitly. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Wed, Jun 10, 2009 at 9:20 AM, CHUAN LU <luchuan114@sina.com> wrote: > The result set could include more than one rows in store procedure, What I > want to do like the following. > > Create procedure .... > > ...... > > foreach select c1,c2,c3 into v_c1,v_c2,v_c3 from tb1 where condition > > return v_c1,v_c2,v_c3 with resume; > > end foreach; > > ....... > > foreach select c1,c2,c3,c4 into v_c1,v_c2,v_c3,v_c4 from tb2 where > condition > > return v_c1,v_c2,v_c3,v_c4 with resume; > > end foreach; > end procedure; > > I want to return two result sets in one store procedure. > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --001636c5b2f07c6838046bff1e8a