<?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: secondmax</title>
	<atom:link href="http://laurentschneider.com/wordpress/2008/07/secondmax.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html</link>
	<description>Oracle Certified Master</description>
	<pubDate>Mon, 01 Dec 2008 17:11:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7977</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Wed, 16 Jul 2008 13:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7977</guid>
		<description>me too, but XML is huge!!! good luck</description>
		<content:encoded><![CDATA[<p>me too, but XML is huge!!! good luck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AketiJyuuzou</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7976</link>
		<dc:creator>AketiJyuuzou</dc:creator>
		<pubDate>Wed, 16 Jul 2008 12:48:11 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7976</guid>
		<description>Wow!!

greate solution.
I did not realize to use extractValue.
I will study XML.

In my old posts, my usage of code-tag was wrong.
My solution was below.

&lt;code&gt;
select RTrim(Ltrim(
RegExp_Substr(XMLAgg(XMLElement("dummy",SAL)
                                 order by SAL desc),'&gt;[^&gt;]+&lt;',1,2),'&gt;'),'&lt;') sal
from scott.emp;
&lt;/code&gt;

SAL
----
3000</description>
		<content:encoded><![CDATA[<p>Wow!!</p>
<p>greate solution.<br />
I did not realize to use extractValue.<br />
I will study XML.</p>
<p>In my old posts, my usage of code-tag was wrong.<br />
My solution was below.</p>
<p><pre><code>
select RTrim(Ltrim(
RegExp_Substr(XMLAgg(XMLElement(&quot;dummy&quot;,SAL)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; order by SAL desc),&#039;&gt;[^&gt;]+&lt;&#039;,1,2),&#039;&gt;&#039;),&#039;&lt;&#039;) sal
from scott.emp;
</code></pre></p>
<p>SAL<br />
&#8212;-<br />
3000</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7975</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Wed, 16 Jul 2008 11:53:13 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7975</guid>
		<description>One more try to show what I learnt from Marco :mrgreen:

select extractvalue(XMLAgg(XMLElement(SAL,SAL) order by SAL desc),'//SAL[2]/text()') SAL FROM EMP

SAL
----
3000</description>
		<content:encoded><![CDATA[<p>One more try to show what I learnt from Marco <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_mrgreen.gif' alt=':mrgreen:' class='wp-smiley' /> </p>
<p>select extractvalue(XMLAgg(XMLElement(SAL,SAL) order by SAL desc),&#8217;//SAL[2]/text()&#8217;) SAL FROM EMP</p>
<p>SAL<br />
&#8212;-<br />
3000</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7974</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Wed, 16 Jul 2008 11:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7974</guid>
		<description>Ok, let's do it with XMLish functions :)

select extractvalue(XMLAgg(XMLElement(SAL,SAL) order by SAL desc),'/SAL[2]') FROM EMP;

EXTRACTVALUE(XMLAGG(XMLELEMENT(SAL,SAL)ORDERBYSALDESC),'/SAL[2]')
--------------------------------------------------------------------------------
3000</description>
		<content:encoded><![CDATA[<p>Ok, let&#8217;s do it with XMLish functions <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>select extractvalue(XMLAgg(XMLElement(SAL,SAL) order by SAL desc),&#8217;/SAL[2]&#8216;) FROM EMP;</p>
<p>EXTRACTVALUE(XMLAGG(XMLELEMENT(SAL,SAL)ORDERBYSALDESC),&#8217;/SAL[2]&#8216;)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
3000</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7973</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Wed, 16 Jul 2008 11:34:02 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7973</guid>
		<description>no, I do not see your query but I could imagine something like 

&lt;code&gt;
select 
  RegExp_Substr(
    XMLAgg(
      XMLElement(SAL,SAL) order by SAL desc),
    '&lt;.*?&gt;.*?&lt;/.*?&gt;'
  ,1,2) 
FROM EMP;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>no, I do not see your query but I could imagine something like </p>
<p><pre><code>
select 
&nbsp;&nbsp;RegExp_Substr(
&nbsp;&nbsp;&nbsp;&nbsp;XMLAgg(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;XMLElement(SAL,SAL) order by SAL desc),
&nbsp;&nbsp;&nbsp;&nbsp;&#039;&lt;.*?&gt;.*?&lt;/.*?&gt;&#039;
&nbsp;&nbsp;,1,2) 
FROM EMP;
</code></pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AketiJyuuzou</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7972</link>
		<dc:creator>AketiJyuuzou</dc:creator>
		<pubDate>Wed, 16 Jul 2008 11:02:44 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7972</guid>
		<description>Oh, code-tag of my post was disable.

But I think that Laurent Schneider can understand my solution.

I got hint from this article which used group_concat of MySQL.
http://www.onlamp.com/pub/a/mysql/2007/03/29/emulating-analytic-aka-ranking-functions-with-mysql.html?page=4</description>
		<content:encoded><![CDATA[<p>Oh, code-tag of my post was disable.</p>
<p>But I think that Laurent Schneider can understand my solution.</p>
<p>I got hint from this article which used group_concat of MySQL.<br />
<a href="http://www.onlamp.com/pub/a/mysql/2007/03/29/emulating-analytic-aka-ranking-functions-with-mysql.html?page=4" rel="nofollow">http://www.onlamp.com/pub/a/mysql/2007/03/29/emulating-analytic-aka-ranking-functions-with-mysql.html?page=4</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AketiJyuuzou</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7971</link>
		<dc:creator>AketiJyuuzou</dc:creator>
		<pubDate>Wed, 16 Jul 2008 10:58:05 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7971</guid>
		<description>Oh I post again.
I have used code-tag.

My funny solution 8-)

[code]
select RTrim(Ltrim(RegExp_Substr(XMLAgg(XMLElement("dummy",SAL) order by SAL desc),'&#62;[^'),'</description>
		<content:encoded><![CDATA[<p>Oh I post again.<br />
I have used code-tag.</p>
<p>My funny solution <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </p>
<p>[code]<br />
select RTrim(Ltrim(RegExp_Substr(XMLAgg(XMLElement(&#8221;dummy&#8221;,SAL) order by SAL desc),&#8217;&gt;[^&#8217;),&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AketiJyuuzou</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7970</link>
		<dc:creator>AketiJyuuzou</dc:creator>
		<pubDate>Wed, 16 Jul 2008 10:56:58 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7970</guid>
		<description>My funny solution 8-)

select RTrim(Ltrim(RegExp_Substr(XMLAgg(XMLElement("dummy",SAL) order by SAL desc),'&#62;[^'),'</description>
		<content:encoded><![CDATA[<p>My funny solution <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </p>
<p>select RTrim(Ltrim(RegExp_Substr(XMLAgg(XMLElement(&#8221;dummy&#8221;,SAL) order by SAL desc),&#8217;&gt;[^&#8217;),&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: radino</title>
		<link>http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7925</link>
		<dc:creator>radino</dc:creator>
		<pubDate>Fri, 11 Jul 2008 05:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/07/secondmax.html#comment-7925</guid>
		<description>I would not use RANK()..
&lt;code&gt;
SQL&gt; SELECT ENAME, SAL FROM (
  2    SELECT ENAME, SAL FROM EMP ORDER BY SAL DESC)
  3  WHERE ROWNUM &lt; 5;
 
ENAME            SAL
---------- ---------
KING         5000,00
SCOTT        3000,00
FORD         3000,00
JONES        2975,00
 
SQL&gt; 
SQL&gt; 
SQL&gt; SELECT SAL
  2  FROM (
  3    SELECT RANK() OVER (ORDER BY SAL DESC) R,SAL FROM EMP)
  4  WHERE R=2;
 
      SAL
---------
  3000,00
  3000,00
 
SQL&gt; 
SQL&gt; 
SQL&gt; UPDATE EMP
  2  SET SAL=5000
  3  WHERE ENAME='JONES';
 
1 row updated
 
SQL&gt; 
SQL&gt; 
SQL&gt; SELECT SAL
  2  FROM (
  3    SELECT RANK() OVER (ORDER BY SAL DESC) R,SAL FROM EMP)
  4  WHERE R=2;
 
      SAL
---------
 
SQL&gt; 
SQL&gt; ROLLBACK;
 
Rollback complete
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I would not use RANK()..<br />
<pre><code>
SQL&gt; SELECT ENAME, SAL FROM (
&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;SELECT ENAME, SAL FROM EMP ORDER BY SAL DESC)
&nbsp;&nbsp;3&nbsp;&nbsp;WHERE ROWNUM &lt; 5;
 
ENAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SAL
---------- ---------
KING&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5000,00
SCOTT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3000,00
FORD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3000,00
JONES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2975,00
 
SQL&gt; 
SQL&gt; 
SQL&gt; SELECT SAL
&nbsp;&nbsp;2&nbsp;&nbsp;FROM (
&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;SELECT RANK() OVER (ORDER BY SAL DESC) R,SAL FROM EMP)
&nbsp;&nbsp;4&nbsp;&nbsp;WHERE R=2;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SAL
---------
&nbsp;&nbsp;3000,00
&nbsp;&nbsp;3000,00
 
SQL&gt; 
SQL&gt; 
SQL&gt; UPDATE EMP
&nbsp;&nbsp;2&nbsp;&nbsp;SET SAL=5000
&nbsp;&nbsp;3&nbsp;&nbsp;WHERE ENAME=&#039;JONES&#039;;
 
1 row updated
 
SQL&gt; 
SQL&gt; 
SQL&gt; SELECT SAL
&nbsp;&nbsp;2&nbsp;&nbsp;FROM (
&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;SELECT RANK() OVER (ORDER BY SAL DESC) R,SAL FROM EMP)
&nbsp;&nbsp;4&nbsp;&nbsp;WHERE R=2;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SAL
---------
 
SQL&gt; 
SQL&gt; ROLLBACK;
 
Rollback complete
</code></pre></p>
]]></content:encoded>
	</item>
</channel>
</rss>
