<?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: OR aggregate</title>
	<atom:link href="http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html</link>
	<description>Oracle Certified Master</description>
	<pubDate>Mon, 01 Dec 2008 21:33:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5560</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 06 Dec 2007 11:15:22 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5560</guid>
		<description>wow! this is exactly the same, I like this ;-)

arigato!</description>
		<content:encoded><![CDATA[<p>wow! this is exactly the same, I like this <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>arigato!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aketi Jyuuzou</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5559</link>
		<dc:creator>Aketi Jyuuzou</dc:creator>
		<pubDate>Thu, 06 Dec 2007 10:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5559</guid>
		<description>http://oraclesqlpuzzle.hp.infoseek.co.jp/8-20.html
My site mentions these solutions 8-) (written by Japanese language)
Thank you :-D</description>
		<content:encoded><![CDATA[<p><a href="http://oraclesqlpuzzle.hp.infoseek.co.jp/8-20.html" rel="nofollow">http://oraclesqlpuzzle.hp.infoseek.co.jp/8-20.html</a><br />
My site mentions these solutions <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> (written by Japanese language)<br />
Thank you <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5524</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 03 Dec 2007 09:34:02 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5524</guid>
		<description>for AGGREGATE_BITXOR, I would then use :
&lt;code&gt;select
mod(sum(sign(bitand(32,n))),2)*32+
mod(sum(sign(bitand(16,n))),2)*16+
mod(sum(sign(bitand( 8,n))),2)* 8+
mod(sum(sign(bitand( 4,n))),2)* 4+
mod(sum(sign(bitand( 2,n))),2)* 2+
mod(sum(sign(bitand( 1,n))),2) n
from t; 
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>for AGGREGATE_BITXOR, I would then use :<br />
<pre><code>select
mod(sum(sign(bitand(32,n))),2)*32+
mod(sum(sign(bitand(16,n))),2)*16+
mod(sum(sign(bitand( 8,n))),2)* 8+
mod(sum(sign(bitand( 4,n))),2)* 4+
mod(sum(sign(bitand( 2,n))),2)* 2+
mod(sum(sign(bitand( 1,n))),2) n
from t; 
</code></pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5523</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 03 Dec 2007 09:27:42 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5523</guid>
		<description>and for AGGREGATE_BITAND, we could use MIN then!</description>
		<content:encoded><![CDATA[<p>and for AGGREGATE_BITAND, we could use MIN then!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5522</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 03 Dec 2007 09:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5522</guid>
		<description>this makes sense!</description>
		<content:encoded><![CDATA[<p>this makes sense!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aketi Jyuuzou</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5521</link>
		<dc:creator>Aketi Jyuuzou</dc:creator>
		<pubDate>Mon, 03 Dec 2007 08:54:53 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5521</guid>
		<description>oops
We can use solution which is more simple.

with t as (
select 10 n from dual union all
select 12 from dual union all
select 6 from dual)
select
max(bitand(32,n))+
max(bitand(16,n))+
max(bitand( 8,n))+
max(bitand( 4,n))+
max(bitand( 2,n))+
max(bitand( 1,n)) as N
from t;</description>
		<content:encoded><![CDATA[<p>oops<br />
We can use solution which is more simple.</p>
<p>with t as (<br />
select 10 n from dual union all<br />
select 12 from dual union all<br />
select 6 from dual)<br />
select<br />
max(bitand(32,n))+<br />
max(bitand(16,n))+<br />
max(bitand( 8,n))+<br />
max(bitand( 4,n))+<br />
max(bitand( 2,n))+<br />
max(bitand( 1,n)) as N<br />
from t;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5520</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 03 Dec 2007 08:14:54 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5520</guid>
		<description>Nice approach, I wished I found it myself :-D</description>
		<content:encoded><![CDATA[<p>Nice approach, I wished I found it myself <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aketi Jyuuzou</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5519</link>
		<dc:creator>Aketi Jyuuzou</dc:creator>
		<pubDate>Mon, 03 Dec 2007 07:04:28 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5519</guid>
		<description>Oh
Good solution!

I post homeMadeBitOr :-)

with t as (
  select 10 n from dual union all
  select 12 from dual union all
  select 6 from dual)
select
sum(distinct(bitand(32,n)))+
sum(distinct(bitand(16,n)))+
sum(distinct(bitand( 8,n)))+
sum(distinct(bitand( 4,n)))+
sum(distinct(bitand( 2,n)))+
sum(distinct(bitand( 1,n))) as N
  from t;</description>
		<content:encoded><![CDATA[<p>Oh<br />
Good solution!</p>
<p>I post homeMadeBitOr <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>with t as (<br />
  select 10 n from dual union all<br />
  select 12 from dual union all<br />
  select 6 from dual)<br />
select<br />
sum(distinct(bitand(32,n)))+<br />
sum(distinct(bitand(16,n)))+<br />
sum(distinct(bitand( 8,n)))+<br />
sum(distinct(bitand( 4,n)))+<br />
sum(distinct(bitand( 2,n)))+<br />
sum(distinct(bitand( 1,n))) as N<br />
  from t;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob van Wijk</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5434</link>
		<dc:creator>Rob van Wijk</dc:creator>
		<pubDate>Sat, 24 Nov 2007 07:44:54 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5434</guid>
		<description>Good points.

Although the preconditions were not mentioned, your solution handles them and is therefore more robust.

Regards,
Rob.</description>
		<content:encoded><![CDATA[<p>Good points.</p>
<p>Although the preconditions were not mentioned, your solution handles them and is therefore more robust.</p>
<p>Regards,<br />
Rob.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5431</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Fri, 23 Nov 2007 16:06:35 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/11/xor-aggregate.html#comment-5431</guid>
		<description>well, if the table contains only one row, it will return null and if the third row is a NULL, it will exit too early (therefore UNTIL PRESENTV)

&lt;code&gt;
with mytable as (
  select 1 p, 63 n from dual union all
  select 2,1 from dual union all
  select 2,1 from dual union all
  select 2,null from dual union all
  select 2,1 from dual)
select p,n
from mytable
model
return updated rows
partition by (p)
dimension by (row_number() over (partition by p order by null) rn)
measures (n)
rules iterate (10000)
until (presentv(n[ITERATION_NUMBER+3],1,2)=2)
(
  n[1] = n[1] + nvl(n[ITERATION_NUMBER+2],0) -
  bitand(n[1],nvl(n[ITERATION_NUMBER+2],0))
)
/

         P          N
---------- ----------
         1         63
         2          1
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>well, if the table contains only one row, it will return null and if the third row is a NULL, it will exit too early (therefore UNTIL PRESENTV)</p>
<p><pre><code>
with mytable as (
&nbsp;&nbsp;select 1 p, 63 n from dual union all
&nbsp;&nbsp;select 2,1 from dual union all
&nbsp;&nbsp;select 2,1 from dual union all
&nbsp;&nbsp;select 2,null from dual union all
&nbsp;&nbsp;select 2,1 from dual)
select p,n
from mytable
model
return updated rows
partition by (p)
dimension by (row_number() over (partition by p order by null) rn)
measures (n)
rules iterate (10000)
until (presentv(n[ITERATION_NUMBER+3],1,2)=2)
(
&nbsp;&nbsp;n[1] = n[1] + nvl(n[ITERATION_NUMBER+2],0) -
&nbsp;&nbsp;bitand(n[1],nvl(n[ITERATION_NUMBER+2],0))
)
/

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;N
---------- ----------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 63
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1
</code></pre></p>
]]></content:encoded>
	</item>
</channel>
</rss>
