<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Multiple result sets returned from embedded SQL in RPG</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/multiple-result-sets-returned-from-embedded-sql-in-rpg/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/multiple-result-sets-returned-from-embedded-sql-in-rpg/</link>
	<description></description>
	<pubDate>Sat, 26 May 2012 03:51:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: teamsi</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/multiple-result-sets-returned-from-embedded-sql-in-rpg/#comment-42115</link>
		<dc:creator>teamsi</dc:creator>
		<pubDate>Mon, 31 Jan 2005 14:42:54 +0000</pubDate>
		<guid isPermaLink="false">#comment-42115</guid>
		<description>Certainly, the sub-select in the UPDATE clause is looking to get back ONE row; so then the question becomes what is exactly returning from the sub-select?  Are ALL the values returning from the sub-select (for any given product, id and campaign) the SAME, if so you can simply use the "DISTINCT" function in your sub-select to return back only ONE row.  If you actually have multiple values returning for one given product, id and campaign then you may need to apply more logic to further isoloate the single correct return value.  The update clause doesn't know which of the returned values to use to complete the operation and is giving you an error for it.

Good luck</description>
		<content:encoded><![CDATA[<p>Certainly, the sub-select in the UPDATE clause is looking to get back ONE row; so then the question becomes what is exactly returning from the sub-select?  Are ALL the values returning from the sub-select (for any given product, id and campaign) the SAME, if so you can simply use the &#8220;DISTINCT&#8221; function in your sub-select to return back only ONE row.  If you actually have multiple values returning for one given product, id and campaign then you may need to apply more logic to further isoloate the single correct return value.  The update clause doesn&#8217;t know which of the returned values to use to complete the operation and is giving you an error for it.</p>
<p>Good luck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rchevalier</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/multiple-result-sets-returned-from-embedded-sql-in-rpg/#comment-42116</link>
		<dc:creator>rchevalier</dc:creator>
		<pubDate>Tue, 04 Jan 2005 09:28:45 +0000</pubDate>
		<guid isPermaLink="false">#comment-42116</guid>
		<description>You have two separate issues, both previously mentioned but maybe this will help clarify them.  

First, you can't assign a cursor to an update statement.  It isn't returning a set of records.

Second, and the actual question you asked I think, is your sub-selects.  You are trying to compare a field value to the result of a select.  This can be done ONLY if the select returns one, and only one, value (row).  In your case it sounds like the sub-select is returning multiple rows.  SQL can't compare the single field value to multiple values (rows) from your sub-select.  You can try changing the '=' to 'in'.  If that doesn't work you will need to either change the sub-select to return only a single value or assign a cursor to your sub-select and process each returned value.

HTH</description>
		<content:encoded><![CDATA[<p>You have two separate issues, both previously mentioned but maybe this will help clarify them.  </p>
<p>First, you can&#8217;t assign a cursor to an update statement.  It isn&#8217;t returning a set of records.</p>
<p>Second, and the actual question you asked I think, is your sub-selects.  You are trying to compare a field value to the result of a select.  This can be done ONLY if the select returns one, and only one, value (row).  In your case it sounds like the sub-select is returning multiple rows.  SQL can&#8217;t compare the single field value to multiple values (rows) from your sub-select.  You can try changing the &#8216;=&#8217; to &#8216;in&#8217;.  If that doesn&#8217;t work you will need to either change the sub-select to return only a single value or assign a cursor to your sub-select and process each returned value.</p>
<p>HTH</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RolandT</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/multiple-result-sets-returned-from-embedded-sql-in-rpg/#comment-42117</link>
		<dc:creator>RolandT</dc:creator>
		<pubDate>Tue, 04 Jan 2005 07:30:57 +0000</pubDate>
		<guid isPermaLink="false">#comment-42117</guid>
		<description>You can't have a cursor associated with an update statement.  You need to setup a select with a cursor, then run an update against the current of the cursor.
</description>
		<content:encoded><![CDATA[<p>You can&#8217;t have a cursor associated with an update statement.  You need to setup a select with a cursor, then run an update against the current of the cursor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: qpgmrs</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/multiple-result-sets-returned-from-embedded-sql-in-rpg/#comment-42118</link>
		<dc:creator>qpgmrs</dc:creator>
		<pubDate>Mon, 03 Jan 2005 10:41:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-42118</guid>
		<description>Thanks Welcome and RolandT!
That is a better statement Welcome.
Roland T you are correct.  I am receiving multiple result sets.  I actually want to process all results.  That is why I need to set a cursor and fetch each record.  With that subselect in there, I am having trouble figuring out how to write the statement to set the cursor.   </description>
		<content:encoded><![CDATA[<p>Thanks Welcome and RolandT!<br />
That is a better statement Welcome.<br />
Roland T you are correct.  I am receiving multiple result sets.  I actually want to process all results.  That is why I need to set a cursor and fetch each record.  With that subselect in there, I am having trouble figuring out how to write the statement to set the cursor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RolandT</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/multiple-result-sets-returned-from-embedded-sql-in-rpg/#comment-42119</link>
		<dc:creator>RolandT</dc:creator>
		<pubDate>Mon, 03 Jan 2005 09:15:28 +0000</pubDate>
		<guid isPermaLink="false">#comment-42119</guid>
		<description>Not sure that I understand your question, but if your getting an error regarding multiple results returned, I think that the system is indicating that one or more sub-selects is returning multiple records.  This is not allowed in a sub-select for an update statement.  </description>
		<content:encoded><![CDATA[<p>Not sure that I understand your question, but if your getting an error regarding multiple results returned, I think that the system is indicating that one or more sub-selects is returning multiple records.  This is not allowed in a sub-select for an update statement.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- dynamic -->
