<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>장재석의 回歸</title>
	<atom:link href="http://loopback.pe.kr/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://loopback.pe.kr/wordpress</link>
	<description>장재석의 회귀 - 다시 되돌아옴.. 사사롭지 않은 공간</description>
	<lastBuildDate>Wed, 18 Apr 2012 14:45:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>아돌프에게 고한다</title>
		<link>http://loopback.pe.kr/wordpress/archives/550</link>
		<comments>http://loopback.pe.kr/wordpress/archives/550#comments</comments>
		<pubDate>Wed, 18 Apr 2012 14:45:36 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[NOTHING]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=550</guid>
		<description><![CDATA[&#160;
&#160;데스카 오사무!
&#160;

]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>&nbsp;데스카 오사무!</p>
<p>&nbsp;</p>
<p><img alt="" src="http://image.yes24.com/goods/3582874/L" /></p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/550/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PC DNS 캐시 삭제</title>
		<link>http://loopback.pe.kr/wordpress/archives/548</link>
		<comments>http://loopback.pe.kr/wordpress/archives/548#comments</comments>
		<pubDate>Fri, 24 Feb 2012 01:44:03 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[NOTHING]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=548</guid>
		<description><![CDATA[C:\Windows\System32&#62;ipconfig /flushdns
Windows IP 구성
DNS 확인자 캐시를 플러시했습니다.
&#160;
무식하면 고생한다. ㅎㅎ
]]></description>
			<content:encoded><![CDATA[<p>C:\Windows\System32&gt;ipconfig /flushdns</p>
<p>Windows IP 구성</p>
<p>DNS 확인자 캐시를 플러시했습니다.</p>
<p>&nbsp;</p>
<p>무식하면 고생한다. ㅎㅎ</p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/548/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excel 새창열기</title>
		<link>http://loopback.pe.kr/wordpress/archives/545</link>
		<comments>http://loopback.pe.kr/wordpress/archives/545#comments</comments>
		<pubDate>Tue, 14 Feb 2012 23:40:56 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[NOTHING]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=545</guid>
		<description><![CDATA[완전 귀찮은 엑셀
xls
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\command\]
[-HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\ddeexec\]
[HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\command]
@=&#34;\&#34;C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE\&#34; /en \&#34;%1\&#34;&#34;
&#160;
xlsx
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\command\]
[-HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\ddeexec\]
[HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\command]
@=&#34;\&#34;C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE\&#34; /en \&#34;%1\&#34;&#34;
]]></description>
			<content:encoded><![CDATA[<p>완전 귀찮은 엑셀</p>
<p>xls</p>
<p>Windows Registry Editor Version 5.00<br />
[-HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\command\]<br />
[-HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\ddeexec\]<br />
[HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\command]<br />
@=&quot;\&quot;C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE\&quot; /en \&quot;%1\&quot;&quot;<br />
&nbsp;</p>
<p>xlsx</p>
<p>Windows Registry Editor Version 5.00<br />
[-HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\command\]<br />
[-HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\ddeexec\]<br />
[HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\Open\command]<br />
@=&quot;\&quot;C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE\&quot; /en \&quot;%1\&quot;&quot;</p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/545/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Table Size 구하기</title>
		<link>http://loopback.pe.kr/wordpress/archives/543</link>
		<comments>http://loopback.pe.kr/wordpress/archives/543#comments</comments>
		<pubDate>Fri, 09 Dec 2011 05:20:30 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[NOTHING]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=543</guid>
		<description><![CDATA[&#160;
SELECT owner, tablespace_name, segment_name as table_name, sum(bytes/1024/1024) Mbyte
FROM dba_extents
WHERE owner = &#8216;OWNER이름&#8217;
and segment_type = &#8216;TABLE&#8217;
AND segment_name like &#8216;TABLE이름&#8217;
GROUP BY owner, tablespace_name, segment_name;







dba_extents
　
　


owner
varchar2(30)
owner of the segment associated with the extent


segment_name
varchar2(81)
name of the segment associated with the extent


partition_name
varchar2(30)
partition/subpartition name, if any, of the segment


segment_type
varchar2(18)
type of the segment


tablespace_name
varchar2(30)
name of the tablespace containing the extent


extent_id
number
extent number in the segment


file_id
number
name [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>SELECT owner, tablespace_name, segment_name as table_name, sum(bytes/1024/1024) Mbyte<br />
FROM dba_extents<br />
WHERE owner = &#8216;OWNER이름&#8217;<br />
and segment_type = &#8216;TABLE&#8217;<br />
AND segment_name like &#8216;TABLE이름&#8217;<br />
GROUP BY owner, tablespace_name, segment_name;</p>
<table border="0" cellspacing="0" cellpadding="0" width="679" style="width: 510pt; border-collapse: collapse">
<colgroup>
<col width="134" style="width: 101pt; mso-width-source: userset; mso-width-alt: 4288" />
<col width="97" style="width: 73pt; mso-width-source: userset; mso-width-alt: 3104" />
<col width="448" style="width: 336pt; mso-width-source: userset; mso-width-alt: 14336" /></colgroup>
<tbody>
<tr height="18" style="height: 13.5pt">
<td class="xl67" height="18" width="134" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; width: 101pt; height: 13.5pt; border-top: windowtext 0.5pt solid; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">dba_extents</font></td>
<td class="xl66" width="97" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 73pt; border-top: windowtext 0.5pt solid; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">　</font></td>
<td class="xl66" width="448" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 336pt; border-top: windowtext 0.5pt solid; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">　</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">owner</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">varchar2(30)</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">owner of the segment associated with the extent</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">segment_name</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">varchar2(81)</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">name of the segment associated with the extent</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">partition_name</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">varchar2(30)</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">partition/subpartition name, if any, of the segment</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">segment_type</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">varchar2(18)</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">type of the segment</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">tablespace_name</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">varchar2(30)</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">name of the tablespace containing the extent</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">extent_id</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">number</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">extent number in the segment</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">file_id</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">number</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">name of the file containing the extent</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">block_id</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">number</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">starting block number of the extent</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">bytes</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">number</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">size of the extent in bytes</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">blocks</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">number</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">size of the extent in oracle blocks</font></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td class="xl66" height="18" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">relative_fno</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">number</font></td>
<td class="xl66" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><font size="2" face="맑은 고딕">relative number of the file containing the segment header</font></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/543/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Time 2 C Time</title>
		<link>http://loopback.pe.kr/wordpress/archives/541</link>
		<comments>http://loopback.pe.kr/wordpress/archives/541#comments</comments>
		<pubDate>Thu, 17 Nov 2011 04:04:38 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[DEVELOPMENT]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=541</guid>
		<description><![CDATA[select to_number(sysdate &#8211; to_date(&#8217;19700101&#8242;, &#8216;yyyymmdd&#8217;))*(24*60*60) as &#34;C Time&#34;, sysdate from dual;
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
C Time&#160;&#160;&#160; &#124; SYSDATE
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
1321534809 &#124; 2011-11-17 오후 1:00:09
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
select (1321534809/(24*60*60) + to_date(&#8217;19700101&#8242;, &#8216;yyyymmdd&#8217;)) as &#34;Oracle Time&#34; from dual;
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
Oracle Time
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
2011-11-17 오후 1:00:09
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
]]></description>
			<content:encoded><![CDATA[<p>select to_number(sysdate &#8211; to_date(&#8217;19700101&#8242;, &#8216;yyyymmdd&#8217;))*(24*60*60) as &quot;C Time&quot;, sysdate from dual;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
C Time&nbsp;&nbsp;&nbsp; | SYSDATE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
1321534809 | 2011-11-17 오후 1:00:09<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>select (1321534809/(24*60*60) + to_date(&#8217;19700101&#8242;, &#8216;yyyymmdd&#8217;)) as &quot;Oracle Time&quot; from dual;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Oracle Time<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
2011-11-17 오후 1:00:09<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/541/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSL 인증서 설치 여부 확인 방법</title>
		<link>http://loopback.pe.kr/wordpress/archives/530</link>
		<comments>http://loopback.pe.kr/wordpress/archives/530#comments</comments>
		<pubDate>Tue, 04 Oct 2011 06:50:16 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[DEVELOPMENT]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[인증서]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=530</guid>
		<description><![CDATA[&#160;
간단한 명령어로 설치 확인
openssl s_client -connect localhost:443
아래 Certificate chain에 나열된 내용 확인하면 됨
&#160;
#&#62;openssl s_client -connect localhost:443
CONNECTED(00000003)
depth=3 /C=US/O=Equifax/OU=Equifax Secure Certificate Authority
verify return:1
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
verify return:1
depth=1 /C=US/O=GeoTrust, Inc./CN=RapidSSL CA
verify return:1
depth=0 /serialNumber=e9sD25sgKxTIiSKOox8NfZZXSpAQjy4E/C=KR/O=*.XXX.com/OU=GT47962116/OU=See www.rapidssl.com/resources/cps (c)11/OU=Domain Control Validated &#8211; RapidSSL(R)/CN=*.XXX.com
verify return:1
&#8212;
Certificate chain
&#160;0 s:/serialNumber=e9sD25sgKxTIiSKOox8NfZZXSpAQjy4E/C=KR/O=*.XXX.com/OU=GT47962116/OU=See www.rapidssl.com/resources/cps (c)11/OU=Domain Control Validated &#8211; RapidSSL(R)/CN=*.XXX.com
&#160;&#160; i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA
&#160;1 s:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA
&#160;&#160; i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>간단한 명령어로 설치 확인</p>
<p><strong>openssl s_client -connect localhost:443</strong></p>
<p>아래 Certificate chain에 나열된 내용 확인하면 됨<br />
&nbsp;</p>
<p>#&gt;openssl s_client -connect localhost:443<br />
CONNECTED(00000003)<br />
depth=3 /C=US/O=Equifax/OU=Equifax Secure Certificate Authority<br />
verify return:1<br />
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA<br />
verify return:1<br />
depth=1 /C=US/O=GeoTrust, Inc./CN=RapidSSL CA<br />
verify return:1<br />
depth=0 /serialNumber=e9sD25sgKxTIiSKOox8NfZZXSpAQjy4E/C=KR/O=<strong>*.XXX.com</strong>/OU=GT47962116/OU=See <a href="http://www.rapidssl.com/resources/cps">www.rapidssl.com/resources/cps</a> (c)11/OU=Domain Control Validated &#8211; RapidSSL(R)/CN=*.XXX.com<br />
verify return:1<br />
&#8212;<br />
<strong>Certificate chain<br />
&nbsp;0 s:/serialNumber=e9sD25sgKxTIiSKOox8NfZZXSpAQjy4E/C=KR/<u>O=*.XXX.com</u>/OU=GT47962116/OU=See </strong><a href="http://www.rapidssl.com/resources/cps"><strong>www.rapidssl.com/resources/cps</strong></a><strong> (c)11/OU=Domain Control Validated &#8211; RapidSSL(R)/</strong><u><strong>CN=*.XXX.com<br />
</strong></u>&nbsp;&nbsp; i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA<br />
&nbsp;1 s:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA<br />
&nbsp;&nbsp; i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA<br />
&nbsp;2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA<br />
&nbsp;&nbsp; i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority<br />
&nbsp;3 s:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority<br />
&nbsp;&nbsp; i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority<br />
&#8212;<br />
Server certificate<br />
&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<br />
MIIEzTCCA7WgAwIBAgIDA0SWMA0GCSqGSIb3DQEBBQUAMDwxCzAJBgNVBAYTAlVT<br />
&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/530/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Sql Rank Partiton &#8211; 과목별등수(순위) 구하기</title>
		<link>http://loopback.pe.kr/wordpress/archives/528</link>
		<comments>http://loopback.pe.kr/wordpress/archives/528#comments</comments>
		<pubDate>Fri, 03 Jun 2011 05:47:14 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[DEVELOPMENT]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=528</guid>
		<description><![CDATA[&#160;
create table rank_part
(
&#160; 과목&#160;&#160; VARCHAR2(100),
&#160; 학생&#160;&#160; VARCHAR2(100),
&#160; 점수&#160;&#160; int
);







과목
학생
점수


영어
홍길동
23


수학
임꺽정
90


수학
홍길동
100


영어
허생원
56


영어
임꺽정
99


수학
허생원
80



&#160;
select t.*,
&#160;&#160;&#160;&#160;&#160;&#160; rank() over(order by t.점수 desc) as 순위,
&#160;&#160;&#160;&#160;&#160;&#160; rank() over(partition by t.과목 order by t.점수 desc) as 과목별순위
&#160; from rank_part t
&#160;order by t.과목 asc, t.점수 desc;








과목
학생
점수
순위
과목별순위


수학
홍길동
100
1
1


수학
임꺽정
90
3
2


수학
허생원
80
4
3


영어
임꺽정
99
2
1


영어
허생원
56
5
2


영어
홍길동
23
6
3



]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: larger"><span style="font-family: Arial">&nbsp;</span></span></p>
<p><span style="font-size: larger"><span style="font-family: Arial">create table rank_part<br />
(<br />
&nbsp; 과목&nbsp;&nbsp; VARCHAR2(100),<br />
&nbsp; 학생&nbsp;&nbsp; VARCHAR2(100),<br />
&nbsp; 점수&nbsp;&nbsp; int<br />
);</span></span></p>
<table border="0" cellspacing="0" cellpadding="0" width="162" style="width: 123pt; border-collapse: collapse">
<colgroup>
<col width="50" style="width: 38pt" />
<col width="62" style="width: 47pt" />
<col width="50" style="width: 38pt" /></colgroup>
<tbody>
<tr height="17" style="height: 12.75pt">
<td height="17" width="50" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; width: 38pt; height: 12.75pt; border-top: windowtext 0.5pt solid; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>과목</strong></span></span></td>
<td width="62" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 47pt; border-top: windowtext 0.5pt solid; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>학생</strong></span></span></td>
<td width="50" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 38pt; border-top: windowtext 0.5pt solid; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>점수</strong></span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">영어</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">홍길동</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">23</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">수학</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">임꺽정</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">90</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">수학</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">홍길동</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">100</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">영어</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">허생원</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">56</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">영어</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">임꺽정</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">99</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 0.5pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">수학</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">허생원</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">80</span></span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><span style="font-size: larger"><span style="font-family: Arial">select t.*,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rank() over(order by t.점수 desc) as 순위,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rank() over(partition by t.과목 order by t.점수 desc) as 과목별순위<br />
&nbsp; from rank_part t<br />
&nbsp;order by t.과목 asc, t.점수 desc;</span></span></p>
<table border="0" cellspacing="0" cellpadding="0" width="298" style="width: 226pt; border-collapse: collapse">
<colgroup>
<col width="50" style="width: 38pt" />
<col width="62" style="width: 47pt" />
<col span="2" width="50" style="width: 38pt" />
<col width="86" style="width: 65pt" /></colgroup>
<tbody>
<tr height="17" style="height: 12.75pt">
<td height="17" width="50" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 1pt solid; background-color: transparent; width: 38pt; height: 12.75pt; border-top: windowtext 1pt solid; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>과목</strong></span></span></td>
<td width="62" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 47pt; border-top: windowtext 1pt solid; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>학생</strong></span></span></td>
<td width="50" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 38pt; border-top: windowtext 1pt solid; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>점수</strong></span></span></td>
<td width="50" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 38pt; border-top: windowtext 1pt solid; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>순위</strong></span></span></td>
<td width="86" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; width: 65pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid"><span style="font-size: larger"><span style="font-family: Arial"><strong>과목별순위</strong></span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 1pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">수학</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">홍길동</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">100</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">1</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 1pt solid"><span style="font-size: larger"><span style="font-family: Arial">1</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 1pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">수학</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">임꺽정</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">90</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">3</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 1pt solid"><span style="font-size: larger"><span style="font-family: Arial">2</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 1pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">수학</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">허생원</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">80</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">4</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 1pt solid"><span style="font-size: larger"><span style="font-family: Arial">3</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 1pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">영어</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">임꺽정</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">99</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">2</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 1pt solid"><span style="font-size: larger"><span style="font-family: Arial">1</span></span></td>
</tr>
<tr height="17" style="height: 12.75pt">
<td height="17" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext 1pt solid; background-color: transparent; height: 12.75pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">영어</span></span></td>
<td style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">허생원</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">56</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">5</span></span></td>
<td align="right" style="border-bottom: windowtext 0.5pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 1pt solid"><span style="font-size: larger"><span style="font-family: Arial">2</span></span></td>
</tr>
<tr height="18" style="height: 13.5pt">
<td height="18" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; background-color: transparent; height: 13.5pt; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">영어</span></span></td>
<td style="border-bottom: windowtext 1pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">홍길동</span></span></td>
<td align="right" style="border-bottom: windowtext 1pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">23</span></span></td>
<td align="right" style="border-bottom: windowtext 1pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 0.5pt solid"><span style="font-size: larger"><span style="font-family: Arial">6</span></span></td>
<td align="right" style="border-bottom: windowtext 1pt solid; border-left: windowtext; background-color: transparent; border-top: windowtext; border-right: windowtext 1pt solid"><span style="font-size: larger"><span style="font-family: Arial">3</span></span></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/528/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whois Open API</title>
		<link>http://loopback.pe.kr/wordpress/archives/525</link>
		<comments>http://loopback.pe.kr/wordpress/archives/525#comments</comments>
		<pubDate>Tue, 17 May 2011 06:58:06 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[DEVELOPMENT]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=525</guid>
		<description><![CDATA[사용방법은..
http://whois.kisa.or.kr/openapi/whois.php?ip_name=127.0.0.1&#38;key=xxxxx
http://whois.kisa.or.kr/openapi/whois.php?domain_name=naver.com&#38;key=xxxxx
KEY는 암호화해서
Am4c952OP2RlXY0H/sFixSqC4rKnIdcjthcNfdHC4vs=
결과는
&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62;

- &#60;whois&#62;


&#160;&#160;&#160;&#160;&#160; &#60;query&#62;52.32.214.231&#60;/query&#62;


&#160;&#160;&#160;&#160;&#160; &#60;queryType&#62;ipv4&#60;/queryType&#62;


&#160;&#160;&#160;&#160;&#160; &#60;registry&#62;ARIN&#60;/registry&#62;


&#160;&#160;&#160;&#160;&#160; &#60;countryCode&#62;US&#60;/countryCode&#62;

&#60;/whois&#62;


]]></description>
			<content:encoded><![CDATA[<p>사용방법은..</p>
<p><a href="http://whois.kisa.or.kr/openapi/whois.php?ip_name=127.0.0.1&amp;key=xxxxx">http://whois.kisa.or.kr/openapi/whois.php?ip_name=127.0.0.1&amp;key=xxxxx</a><br />
<a href="http://whois.kisa.or.kr/openapi/whois.php?domain_name=naver.com&amp;key=xxxxx">http://whois.kisa.or.kr/openapi/whois.php?domain_name=naver.com&amp;key=xxxxx</a></p>
<p>KEY는 암호화해서</p>
<p>Am4c952OP2RlXY0H/sFixSqC4rKnIdcjthcNfdHC4vs=</p>
<p>결과는</p>
<div class="e"><font color="#0000ff"><span class="m">&lt;?</span><span class="pi">xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; </span><span class="m">?&gt;</span></font></div>
<div class="e">
<div class="c" style="text-indent: -2em; margin-left: 1em"><a class="b" href="http://loopback.pe.kr/wordpress#"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">whois</font></span><span class="m"><font color="#0000ff">&gt;</font></span></div>
<div>
<div class="e">
<div style="text-indent: -2em; margin-left: 1em"><span class="b"><strong><font color="#ff0000" face="Courier New">&nbsp;</font></strong></span>&nbsp;&nbsp;&nbsp;&nbsp; <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">query</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>52.32.214.231</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">query</font></span><span class="m"><font color="#0000ff">&gt;</font></span></div>
</div>
<div class="e">
<div style="text-indent: -2em; margin-left: 1em"><span class="b"><strong><font color="#ff0000" face="Courier New">&nbsp;</font></strong></span>&nbsp;&nbsp;&nbsp;&nbsp; <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">queryType</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>ipv4</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">queryType</font></span><span class="m"><font color="#0000ff">&gt;</font></span></div>
</div>
<div class="e">
<div style="text-indent: -2em; margin-left: 1em"><span class="b"><strong><font color="#ff0000" face="Courier New">&nbsp;</font></strong></span>&nbsp;&nbsp;&nbsp;&nbsp; <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">registry</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>ARIN</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">registry</font></span><span class="m"><font color="#0000ff">&gt;</font></span></div>
</div>
<div class="e">
<div style="text-indent: -2em; margin-left: 1em"><span class="b"><strong><font color="#ff0000" face="Courier New">&nbsp;</font></strong></span>&nbsp;&nbsp;&nbsp;&nbsp; <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">countryCode</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>US</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">countryCode</font></span><span class="m"><font color="#0000ff">&gt;</font></span></div>
</div>
<div><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">whois</font></span><span class="m"><font color="#0000ff">&gt;</font></span></div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/525/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ansi joins in oracle 9i</title>
		<link>http://loopback.pe.kr/wordpress/archives/523</link>
		<comments>http://loopback.pe.kr/wordpress/archives/523#comments</comments>
		<pubDate>Mon, 16 May 2011 01:48:34 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[DEVELOPMENT]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=523</guid>
		<description><![CDATA[&#160;
ansi joins in oracle 9i
Oracle has introduced ANSI-compliant joins into its SQL implementation in 9i Release One (9.0). This provides an alternative syntax to joining datasets together, which can be used in conjunction, or as an alternative to, existing Oracle syntax. This article briefly introduces the new syntax.
a note on the examples
The examples of ANSI-compliant [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<h2 name="d4722">ansi joins in oracle 9i</h2>
<p>Oracle has introduced ANSI-compliant joins into its SQL implementation in 9i Release One (9.0). This provides an alternative syntax to joining datasets together, which can be used in conjunction, or as an alternative to, existing Oracle syntax. This article briefly introduces the new syntax.</p>
<h3 id="e9317" name="e9317">a note on the examples</h3>
<p>The examples of ANSI-compliant joins in this article are mostly drawn from the EMP and DEPT tables. These tables are familiar to most developers and contain few records, which limits the output we will generate. Wherever possible, the equivalent Oracle syntax is included for reference.</p>
<h3 id="c53dd" name="c53dd">general syntax</h3>
<p>With Oracle, we are used to joining datasets by combinations of datasources in the FROM clause and a WHERE clause to join them together. Datasets are usually tables, but can also be views, in-inline views, subqueries, table functions, nested tables and so on. Oracle join syntax is generally as follows:</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> <span class="sh_symbol">...</span>
<span class="sh_keyword">FROM</span>   dataset_one d1
<span class="sh_symbol">,</span>      dataset_two d2
<span class="sh_keyword">WHERE</span>  d1<span class="sh_symbol">.</span><span class="sh_keyword">column</span><span class="sh_symbol">(</span>s<span class="sh_symbol">)</span> <span class="sh_symbol">=</span> d2<span class="sh_symbol">.</span><span class="sh_keyword">column</span><span class="sh_symbol">(</span>s<span class="sh_symbol">)</span>
<span class="sh_keyword">AND</span>    <span class="sh_symbol">...</span>
</pre>
<p>With this syntax we separate datasources by commas and code a single WHERE clause that will include the join predicates together with any filter predicates we might require. ANSI join syntax is slightly different on two counts. First, we specify the type of join we require and second we separate the join predicates from the filter predicates. ASNI syntax can notionally be expressed as follows:</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> <span class="sh_symbol">...</span>
<span class="sh_keyword">FROM</span>   dataset_one d1
       <span class="sh_keyword">JOIN</span> <span class="sh_keyword">TYPE</span>
       dataset_two d2
       <span class="sh_keyword">ON</span> <span class="sh_symbol">(</span>d1<span class="sh_symbol">.</span><span class="sh_keyword">column</span><span class="sh_symbol">(</span>s<span class="sh_symbol">)</span> <span class="sh_symbol">=</span> d2<span class="sh_symbol">.</span><span class="sh_keyword">column</span><span class="sh_symbol">(</span>s<span class="sh_symbol">))</span> <span class="sh_comment">--&lt;-- can also use USING (column(s))</span>
<span class="sh_keyword">WHERE</span>  filter_predicates<span class="sh_symbol">...</span>
</pre>
<p>As commented, the ON clause is where we specify our joins. If the column names are the same, we can replace this with a USING clause. We will see examples of both methods for expressing join predicates throughout this article.</p>
<p>Given this pseudo-syntax, we will examples of the following join types in this article.</p>
<ul>
<li>INNER JOIN</li>
<li>NATURAL JOIN</li>
<li>CROSS JOIN</li>
<li>LEFT OUTER JOIN</li>
<li>RIGHT OUTER JOIN</li>
<li>FULL OUTER JOIN</li>
</ul>
<h3 id="d3401" name="d3401">inner join</h3>
<p>When we join two tables or datasets together on an equality (i.e. column or set of columns) we are performing an inner join. The ANSI method for joining EMP and DEPT is as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
RESEARCH       DALLAS        SMITH      CLERK
SALES          CHICAGO       ALLEN      SALESMAN
SALES          CHICAGO       WARD       SALESMAN
RESEARCH       DALLAS        JONES      MANAGER
SALES          CHICAGO       MARTIN     SALESMAN
SALES          CHICAGO       BLAKE      MANAGER
ACCOUNTING     NEW YORK      CLARK      MANAGER
RESEARCH       DALLAS        SCOTT      ANALYST
ACCOUNTING     NEW YORK      KING       PRESIDENT
SALES          CHICAGO       TURNER     SALESMAN
RESEARCH       DALLAS        ADAMS      CLERK
SALES          CHICAGO       JAMES      CLERK
RESEARCH       DALLAS        FORD       ANALYST
ACCOUNTING     NEW YORK      MILLER     CLERK

14 rows selected.
</pre>
<p>Note that the INNER keyword is optional and JOIN alone will work. In this example we used the USING(deptno) clause to specify our join predicate. We were able to use this because both tables have the same join-column name. When we use this clause, however, we cannot alias the join columns anywhere in our query as the following example demonstrates.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_keyword">COUNT</span><span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
SELECT COUNT(d.deptno)
             *
ERROR at line 1:
ORA-25154: column part of USING clause cannot have qualifier
</pre>
<p>The error message is reasonably meaningful (though &quot;alias&quot; might have been a better choice of word than &quot;qualifier&quot;). The correct way to express this query is to simply remove the alias as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_keyword">COUNT</span><span class="sh_symbol">(</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
COUNT(DEPTNO)
-------------
           14

1 row selected.
</pre>
<p>As stated in the syntax overview earlier, we can also use an ON clause to express our join predicates. This is necessary when the join columns have different names or when we wish to alias our columns. The parentheses around the ON clause are optional.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
RESEARCH       DALLAS        SMITH      CLERK
SALES          CHICAGO       ALLEN      SALESMAN
SALES          CHICAGO       WARD       SALESMAN
RESEARCH       DALLAS        JONES      MANAGER
SALES          CHICAGO       MARTIN     SALESMAN
SALES          CHICAGO       BLAKE      MANAGER
ACCOUNTING     NEW YORK      CLARK      MANAGER
RESEARCH       DALLAS        SCOTT      ANALYST
ACCOUNTING     NEW YORK      KING       PRESIDENT
SALES          CHICAGO       TURNER     SALESMAN
RESEARCH       DALLAS        ADAMS      CLERK
SALES          CHICAGO       JAMES      CLERK
RESEARCH       DALLAS        FORD       ANALYST
ACCOUNTING     NEW YORK      MILLER     CLERK

14 rows selected.
</pre>
<p>The Oracle equivalent of the inner joins we have seen so far is as follows.</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
<span class="sh_keyword">FROM</span>   dept d
<span class="sh_symbol">,</span>      emp e
<span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno<span class="sh_symbol">;</span>
</pre>
<p>One of the key differences between ANSI and Oracle syntax is that the former separates the join and filter predicates. On complex statements, this can be extremely useful. In the following example, we will join EMP and DEPT but add a filter predicate on DEPT using the standard WHERE clause.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">6</span>  <span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>loc <span class="sh_symbol">=</span> <span class="sh_string">'DALLAS'</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
RESEARCH       DALLAS        SMITH      CLERK
RESEARCH       DALLAS        JONES      MANAGER
RESEARCH       DALLAS        SCOTT      ANALYST
RESEARCH       DALLAS        ADAMS      CLERK
RESEARCH       DALLAS        FORD       ANALYST

5 rows selected.
</pre>
<p>We could add the filter to the ON clause but this makes no difference to performance, even if the filter is on the second table. Furthermore, adding filter predicates to the ON clause can cause data issues with outer joins (we will see an example of this later), so we should avoid this practice altogether.</p>
<p>For reference, the Oracle syntax for the inner join with an additional filter predicate is as follows.</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
<span class="sh_keyword">FROM</span>   dept d
<span class="sh_symbol">,</span>      emp e
<span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno
<span class="sh_keyword">AND</span>    d<span class="sh_symbol">.</span>loc <span class="sh_symbol">=</span> <span class="sh_string">'DALLAS'</span><span class="sh_symbol">;</span>
</pre>
<h3 id="7eaab" name="7eaab">natural join</h3>
<p>A natural join will join two datasets on all matching column names, regardless of whether the columns are actually related in anything other than name. For example, the EMP and DEPT tables share one common column name and a natural join between the two tables would be correct in this scenario.</p>
<p>The following example converts our INNER JOIN from previous examples to a NATURAL JOIN.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">NATURAL</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e<span class="sh_symbol">;</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
RESEARCH       DALLAS        SMITH      CLERK
SALES          CHICAGO       ALLEN      SALESMAN
SALES          CHICAGO       WARD       SALESMAN
RESEARCH       DALLAS        JONES      MANAGER
SALES          CHICAGO       MARTIN     SALESMAN
SALES          CHICAGO       BLAKE      MANAGER
ACCOUNTING     NEW YORK      CLARK      MANAGER
RESEARCH       DALLAS        SCOTT      ANALYST
ACCOUNTING     NEW YORK      KING       PRESIDENT
SALES          CHICAGO       TURNER     SALESMAN
RESEARCH       DALLAS        ADAMS      CLERK
SALES          CHICAGO       JAMES      CLERK
RESEARCH       DALLAS        FORD       ANALYST
ACCOUNTING     NEW YORK      MILLER     CLERK

14 rows selected.
</pre>
<p>Note that the only identifiable benefit of NATURAL JOIN is that we do not need to specify a join predicate. Oracle determines all matching column names and uses these to join the two tables. We cannot alias any columns used in the natural join, as the following example demonstrates.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_keyword">COUNT</span><span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">NATURAL</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e<span class="sh_symbol">;</span>
</pre>
<pre class="output">
SELECT COUNT(d.deptno)
             *
ERROR at line 1:
ORA-25155: column used in NATURAL join cannot have qualifier
</pre>
<p>As we saw earlier with the USING clause for our INNER JOIN examples, the solution is to remove any aliases on shared column names.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_keyword">COUNT</span><span class="sh_symbol">(</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">NATURAL</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e<span class="sh_symbol">;</span>
</pre>
<pre class="output">
COUNT(DEPTNO)
-------------
           14

1 row selected.
</pre>
<p>With EMP and DEPT as our demonstration tables, we are fortunate that the NATURAL JOIN gives us the correct answer. Commercial data models are not always so rigid in the naming of columns and the data they contain, especially as systems grow over time. We can imagine the consequences of adding another column to EMP that shares the same name as one in DEPT.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">ALTER</span> <span class="sh_keyword">TABLE</span> emp <span class="sh_keyword">ADD</span> loc <span class="sh_type">VARCHAR2</span><span class="sh_symbol">(</span><span class="sh_number">10</span><span class="sh_symbol">)</span> <span class="sh_keyword">DEFAULT</span> <span class="sh_string">'LONDON'</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
Table altered.
</pre>
<pre class="sh_oracle nopad sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">NATURAL</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e<span class="sh_symbol">;</span>
</pre>
<pre class="output">
no rows selected
</pre>
<p>Probably the best advice to offer regarding NATURAL JOIN is to avoid it! Note that there is no equivalent Oracle syntax.</p>
<h3 id="c3bd7" name="c3bd7">left outer join</h3>
<p>In traditional Oracle syntax, outer joins are indicated by (+) and this can sometimes cause issues when attempting to outer join multiple tables or includeg expressions in join predicates. Oracle outer joins have no concept of direction, whereas ANSI-compliant outer joins do. In the following example, we will outer join DEPT to EMP using the ANSI LEFT OUTER JOIN. The way to interpret this is to read the tables in the FROM clause from left to right. The left-hand table is the superset and the table on the right is the potentially deficient set.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> deptno<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
    DEPTNO DNAME          LOC           ENAME      JOB
---------- -------------- ------------- ---------- ---------
        20 RESEARCH       DALLAS        SMITH      CLERK
        30 SALES          CHICAGO       ALLEN      SALESMAN
        30 SALES          CHICAGO       WARD       SALESMAN
        20 RESEARCH       DALLAS        JONES      MANAGER
        30 SALES          CHICAGO       MARTIN     SALESMAN
        30 SALES          CHICAGO       BLAKE      MANAGER
        10 ACCOUNTING     NEW YORK      CLARK      MANAGER
        20 RESEARCH       DALLAS        SCOTT      ANALYST
        10 ACCOUNTING     NEW YORK      KING       PRESIDENT
        30 SALES          CHICAGO       TURNER     SALESMAN
        20 RESEARCH       DALLAS        ADAMS      CLERK
        30 SALES          CHICAGO       JAMES      CLERK
        20 RESEARCH       DALLAS        FORD       ANALYST
        10 ACCOUNTING     NEW YORK      MILLER     CLERK
        40 OPERATIONS     BOSTON

15 rows selected.
</pre>
<p>The OUTER keyword is optional but due to the lack of (+) symbols, including it seems to be more descriptive. Note that this example included the USING clause for our outer join predicates, but the ON clause would also work as well. The Oracle syntax for this join is as follows.</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
<span class="sh_keyword">FROM</span>   dept d
<span class="sh_symbol">,</span>      emp e
<span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno <span class="sh_symbol">(+);</span>
</pre>
<h4 id="b7e14" name="b7e14">outer joins and expressions</h4>
<p>One of the benefits of the ANSI outer join syntax is that it makes expressions much easier to work with (on the occasions where we join a column to an expression). By way of simplified example, we can multiply EMP.DEPTNO by 1 to create a small expression in our DEPT-EMP outer join. The Oracle outer join syntax in this case is uninituitive, as we can see below.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>  <span class="sh_symbol">,</span>      emp e
  <span class="sh_number">4</span>  <span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno<span class="sh_symbol">*</span><span class="sh_number">1</span> <span class="sh_symbol">(+);</span>
</pre>
<pre class="output">
WHERE  d.deptno = e.deptno*1 (+)
                             *
ERROR at line 4:
ORA-00933: SQL command not properly ended
</pre>
<p>The correct way to write this join predicate is as follows which can get tricky with more complicated expressions, especially those involving functions.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>  <span class="sh_symbol">,</span>      emp e
  <span class="sh_number">4</span>  <span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno <span class="sh_symbol">(+)</span> <span class="sh_symbol">*</span> <span class="sh_number">1</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
    DEPTNO DNAME          LOC           ENAME      JOB
---------- -------------- ------------- ---------- ---------
        20 RESEARCH       DALLAS        SMITH      CLERK
        30 SALES          CHICAGO       ALLEN      SALESMAN
        30 SALES          CHICAGO       WARD       SALESMAN
        20 RESEARCH       DALLAS        JONES      MANAGER
        30 SALES          CHICAGO       MARTIN     SALESMAN
        30 SALES          CHICAGO       BLAKE      MANAGER
        10 ACCOUNTING     NEW YORK      CLARK      MANAGER
        20 RESEARCH       DALLAS        SCOTT      ANALYST
        10 ACCOUNTING     NEW YORK      KING       PRESIDENT
        30 SALES          CHICAGO       TURNER     SALESMAN
        20 RESEARCH       DALLAS        ADAMS      CLERK
        30 SALES          CHICAGO       JAMES      CLERK
        20 RESEARCH       DALLAS        FORD       ANALYST
        10 ACCOUNTING     NEW YORK      MILLER     CLERK
        40 OPERATIONS     BOSTON

15 rows selected.
</pre>
<p>ANSI syntax makes this much easier as no special considerations are needed, as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>         <span class="sh_keyword">ON</span> <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno <span class="sh_symbol">*</span> <span class="sh_number">1</span><span class="sh_symbol">);</span>
</pre>
<pre class="output">
    DEPTNO DNAME          LOC           ENAME      JOB
---------- -------------- ------------- ---------- ---------
        20 RESEARCH       DALLAS        SMITH      CLERK
        30 SALES          CHICAGO       ALLEN      SALESMAN
        30 SALES          CHICAGO       WARD       SALESMAN
        20 RESEARCH       DALLAS        JONES      MANAGER
        30 SALES          CHICAGO       MARTIN     SALESMAN
        30 SALES          CHICAGO       BLAKE      MANAGER
        10 ACCOUNTING     NEW YORK      CLARK      MANAGER
        20 RESEARCH       DALLAS        SCOTT      ANALYST
        10 ACCOUNTING     NEW YORK      KING       PRESIDENT
        30 SALES          CHICAGO       TURNER     SALESMAN
        20 RESEARCH       DALLAS        ADAMS      CLERK
        30 SALES          CHICAGO       JAMES      CLERK
        20 RESEARCH       DALLAS        FORD       ANALYST
        10 ACCOUNTING     NEW YORK      MILLER     CLERK
        40 OPERATIONS     BOSTON

15 rows selected.
</pre>
<h4 id="742ec" name="742ec">outer joins and predicates</h4>
<p>Remember that ANSI join syntax separates join predicates from filter predicates. In the following example, we outer join DEPT and EMP but limit the results to those employees working in DALLAS only.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">6</span>  <span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>loc <span class="sh_symbol">=</span> <span class="sh_string">'DALLAS'</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
RESEARCH       DALLAS        SMITH      CLERK
RESEARCH       DALLAS        JONES      MANAGER
RESEARCH       DALLAS        SCOTT      ANALYST
RESEARCH       DALLAS        ADAMS      CLERK
RESEARCH       DALLAS        FORD       ANALYST

5 rows selected.
</pre>
<p>While it is syntactically possible to move the filter predicates into the join clause, in the case of an ANSI outer join, this can give incorrect results if the filter is on a column from the superset (or &quot;driving table&quot;). In the following example, we move the filter predicate from our previous query into the ON clause.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno
  <span class="sh_number">6</span>  <span class="sh_keyword">AND</span>    d<span class="sh_symbol">.</span>loc <span class="sh_symbol">=</span> <span class="sh_string">'DALLAS'</span><span class="sh_symbol">);</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
ACCOUNTING     NEW YORK
RESEARCH       DALLAS        SMITH      CLERK
RESEARCH       DALLAS        JONES      MANAGER
RESEARCH       DALLAS        SCOTT      ANALYST
RESEARCH       DALLAS        ADAMS      CLERK
RESEARCH       DALLAS        FORD       ANALYST
SALES          CHICAGO
OPERATIONS     BOSTON

8 rows selected.
</pre>
<p>We can see that these results are wrong and that the driving table has all of its data returned by this query. What if we wish to outer join to a subset of EMP? In this case, the filter predicates on EMP columns can be safely included in the join predicates, as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno
  <span class="sh_number">6</span>  <span class="sh_keyword">AND</span>    e<span class="sh_symbol">.</span>job <span class="sh_symbol">=</span> <span class="sh_string">'SALESMAN'</span><span class="sh_symbol">);</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
SALES          CHICAGO       ALLEN      SALESMAN
SALES          CHICAGO       WARD       SALESMAN
SALES          CHICAGO       MARTIN     SALESMAN
SALES          CHICAGO       TURNER     SALESMAN
OPERATIONS     BOSTON
RESEARCH       DALLAS
ACCOUNTING     NEW YORK

7 rows selected.
</pre>
<p>If we move the EMP filter predicates to the WHERE clause, we see inconsistent results again, as follows. This is the semantic equivalent of an inner join because all outer joined records will have a NULL JOB.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">6</span>  <span class="sh_keyword">WHERE</span>  e<span class="sh_symbol">.</span>job <span class="sh_symbol">=</span> <span class="sh_string">'SALESMAN'</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB
-------------- ------------- ---------- ---------
SALES          CHICAGO       ALLEN      SALESMAN
SALES          CHICAGO       WARD       SALESMAN
SALES          CHICAGO       MARTIN     SALESMAN
SALES          CHICAGO       TURNER     SALESMAN

4 rows selected.
</pre>
<p>For reference, the Oracle equivalent of this type of outer join is as follows.</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
<span class="sh_keyword">FROM</span>   dept d
<span class="sh_symbol">,</span>     <span class="sh_symbol">(</span><span class="sh_keyword">SELECT</span> ename<span class="sh_symbol">,</span> job<span class="sh_symbol">,</span> deptno
       <span class="sh_keyword">FROM</span>   emp
       <span class="sh_keyword">WHERE</span>  job <span class="sh_symbol">=</span> <span class="sh_string">'SALESMAN'</span><span class="sh_symbol">)</span> e
<span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno <span class="sh_symbol">(+);</span>
</pre>
<h4 id="8f3cb" name="8f3cb">outer joins as anti-joins</h4>
<p>Outer joins are often used as an alternative to anti-joins, particularly NOT IN queries. The Oracle syntax for this is as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>  <span class="sh_symbol">,</span>      emp e
  <span class="sh_number">4</span>  <span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno <span class="sh_symbol">(+)</span>
  <span class="sh_number">5</span>  <span class="sh_keyword">AND</span>    e<span class="sh_symbol">.</span>deptno <span class="sh_keyword">IS</span> <span class="sh_keyword">NULL</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
DNAME          LOC
-------------- -------------
OPERATIONS     BOSTON

1 row selected.
</pre>
<p>This can be expressed as a NOT IN query as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>  <span class="sh_keyword">WHERE</span>  d<span class="sh_symbol">.</span>deptno <span class="sh_keyword">NOT</span> <span class="sh_keyword">IN</span> <span class="sh_symbol">(</span><span class="sh_keyword">SELECT</span> e<span class="sh_symbol">.</span>deptno <span class="sh_keyword">FROM</span> emp e<span class="sh_symbol">);</span>
</pre>
<pre class="output">
DNAME          LOC
-------------- -------------
OPERATIONS     BOSTON

1 row selected.
</pre>
<p>The ANSI equivalent for this technique is shown below.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">6</span>  <span class="sh_keyword">WHERE</span>  e<span class="sh_symbol">.</span>deptno <span class="sh_keyword">IS</span> <span class="sh_keyword">NULL</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
DNAME          LOC
-------------- -------------
OPERATIONS     BOSTON

1 row selected.
</pre>
<h3 id="37ff0" name="37ff0">right outer join</h3>
<p>As its name suggests, a right outer join is an outer join where datasets are driven from right to left (i.e. related to the ordering in the query). There are a few occasions where we might want to use RIGHT OUTER JOIN, but generally, there is nothing to be gained from switching the ordering of the tables in this way.</p>
<p>Everything described in the left outer join section of this article applies equally to right outer joins so we will not spend too much time on these. The following example simply shows how to use this type of join. Again, the OUTER keyword is optional.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> deptno<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   emp  e
  <span class="sh_number">3</span>         <span class="sh_keyword">RIGHT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         dept d
  <span class="sh_number">5</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
    DEPTNO DNAME          LOC           ENAME      JOB
---------- -------------- ------------- ---------- ---------
        20 RESEARCH       DALLAS        SMITH      CLERK
        30 SALES          CHICAGO       ALLEN      SALESMAN
        30 SALES          CHICAGO       WARD       SALESMAN
        20 RESEARCH       DALLAS        JONES      MANAGER
        30 SALES          CHICAGO       MARTIN     SALESMAN
        30 SALES          CHICAGO       BLAKE      MANAGER
        10 ACCOUNTING     NEW YORK      CLARK      MANAGER
        20 RESEARCH       DALLAS        SCOTT      ANALYST
        10 ACCOUNTING     NEW YORK      KING       PRESIDENT
        30 SALES          CHICAGO       TURNER     SALESMAN
        20 RESEARCH       DALLAS        ADAMS      CLERK
        30 SALES          CHICAGO       JAMES      CLERK
        20 RESEARCH       DALLAS        FORD       ANALYST
        10 ACCOUNTING     NEW YORK      MILLER     CLERK
        40 OPERATIONS     BOSTON

15 rows selected.
</pre>
<p>Note that all we have done is to switch the ordering of the tables in the FROM clause such that Oracle will join from right to left. The Oracle equivalent of this query is as follows.</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job
<span class="sh_keyword">FROM</span>   dept d
<span class="sh_symbol">,</span>      emp e
<span class="sh_keyword">WHERE</span>  e<span class="sh_symbol">.</span>deptno <span class="sh_symbol">(+)</span> <span class="sh_symbol">=</span> d<span class="sh_symbol">.</span>deptno<span class="sh_symbol">;</span>
</pre>
<h3 id="7a065" name="7a065">full outer join</h3>
<p>A full outer join will join two datasets from left-to-right and right-to-left. Records that join in both directions are output once to avoid duplication. In the following demonstration, we will create two different subsets of the EMP table. The two subsets will share a small number of common records but each will also have some unique data.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">CREATE</span> <span class="sh_keyword">TABLE</span> e1 <span class="sh_keyword">AS</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span> <span class="sh_keyword">FROM</span> emp <span class="sh_keyword">WHERE</span> deptno <span class="sh_keyword">IN</span> <span class="sh_symbol">(</span><span class="sh_number">10</span><span class="sh_symbol">,</span><span class="sh_number">20</span><span class="sh_symbol">);</span>
</pre>
<pre class="output">
Table created.
</pre>
<pre class="sh_oracle nopad sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">CREATE</span> <span class="sh_keyword">TABLE</span> e2 <span class="sh_keyword">AS</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span> <span class="sh_keyword">FROM</span> emp <span class="sh_keyword">WHERE</span> deptno <span class="sh_keyword">IN</span> <span class="sh_symbol">(</span><span class="sh_number">20</span><span class="sh_symbol">,</span><span class="sh_number">30</span><span class="sh_symbol">);</span>
</pre>
<pre class="output">
Table created.
</pre>
<pre class="sh_oracle nopad sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">exec</span> <span class="sh_keyword">DBMS_STATS.GATHER_TABLE_STATS</span><span class="sh_symbol">(</span><span class="sh_keyword">USER</span><span class="sh_symbol">,</span><span class="sh_string">'E1'</span><span class="sh_symbol">);</span>
</pre>
<pre class="output">
PL/SQL procedure successfully completed.
</pre>
<pre class="sh_oracle nopad sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">exec</span> <span class="sh_keyword">DBMS_STATS.GATHER_TABLE_STATS</span><span class="sh_symbol">(</span><span class="sh_keyword">USER</span><span class="sh_symbol">,</span><span class="sh_string">'E2'</span><span class="sh_symbol">);</span>
</pre>
<pre class="output">
PL/SQL procedure successfully completed.
</pre>
<p>Using SQL Trace to generate an execution plan, we can now see an ANSI FULL OUTER JOIN between these two subsets of EMP.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">ALTER SESSION</span> <span class="sh_keyword">SET</span> <span class="sh_keyword">SQL_TRACE</span> <span class="sh_symbol">=</span> <span class="sh_keyword">TRUE</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
Session altered.
</pre>
<pre class="sh_oracle nopad sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> e1<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_symbol">,</span>      e2<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>job
  <span class="sh_number">3</span>  <span class="sh_keyword">FROM</span>   e1
  <span class="sh_number">4</span>         <span class="sh_keyword">FULL</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">5</span>         e2
  <span class="sh_number">6</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>empno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
ENAME          DEPTNO JOB       ENAME          DEPTNO JOB
---------- ---------- --------- ---------- ---------- ---------
SMITH              20 CLERK     SMITH              20 CLERK
JONES              20 MANAGER   JONES              20 MANAGER
SCOTT              20 ANALYST   SCOTT              20 ANALYST
ADAMS              20 CLERK     ADAMS              20 CLERK
FORD               20 ANALYST   FORD               20 ANALYST
KING               10 PRESIDENT
CLARK              10 MANAGER
MILLER             10 CLERK
                                TURNER             30 SALESMAN
                                BLAKE              30 MANAGER
                                ALLEN              30 SALESMAN
                                WARD               30 SALESMAN
                                MARTIN             30 SALESMAN
                                JAMES              30 CLERK

14 rows selected.
</pre>
<p>We can see that records from both datasets appear in the output, even if they do not have a match in the opposite table. This is what a full outer join does and can be useful when partial datasets (such as delta files) need to be joined.</p>
<p>From the trace file, the execution plan for this query is as follows.</p>
<pre class="sh_oracle sh_sourceCode">&nbsp;</pre>
<pre class="output">
Rows     Row Source Operation
-------  ---------------------------------------------------
     14  VIEW
     14   UNION-ALL
      8    HASH JOIN OUTER
      8     TABLE ACCESS FULL E1
     11     TABLE ACCESS FULL E2
      6    HASH JOIN ANTI
     11     TABLE ACCESS FULL E2
      8     TABLE ACCESS FULL E1
</pre>
<p>The full outer join has performed two separate query blocks (one outer join and one anti-join) and appended the results with UNION ALL as we can see in the execution plan.</p>
<p>This type of ANSI join does not have a direct equivalent in Oracle syntax, but we can simulate it with the following query.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> e1<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>job
  <span class="sh_number">2</span>  <span class="sh_symbol">,</span>      e2<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>job
  <span class="sh_number">3</span>  <span class="sh_keyword">FROM</span>   e1
  <span class="sh_number">4</span>  <span class="sh_symbol">,</span>      e2
  <span class="sh_number">5</span>  <span class="sh_keyword">WHERE</span>  e1<span class="sh_symbol">.</span>empno <span class="sh_symbol">(+)</span> <span class="sh_symbol">=</span> e2<span class="sh_symbol">.</span>empno
  <span class="sh_number">6</span>  <span class="sh_keyword">UNION</span>
  <span class="sh_number">7</span>  <span class="sh_keyword">SELECT</span> e1<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>job
  <span class="sh_number">8</span>  <span class="sh_symbol">,</span>      e2<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>job
  <span class="sh_number">9</span>  <span class="sh_keyword">FROM</span>   e1
 <span class="sh_number">10</span>  <span class="sh_symbol">,</span>      e2
 <span class="sh_number">11</span>  <span class="sh_keyword">WHERE</span>  e1<span class="sh_symbol">.</span>empno <span class="sh_symbol">=</span> e2<span class="sh_symbol">.</span>empno <span class="sh_symbol">(+);</span>
</pre>
<pre class="output">
ENAME          DEPTNO JOB       ENAME          DEPTNO JOB
---------- ---------- --------- ---------- ---------- ---------
ADAMS              20 CLERK     ADAMS              20 CLERK
CLARK              10 MANAGER
FORD               20 ANALYST   FORD               20 ANALYST
JONES              20 MANAGER   JONES              20 MANAGER
KING               10 PRESIDENT
MILLER             10 CLERK
SCOTT              20 ANALYST   SCOTT              20 ANALYST
SMITH              20 CLERK     SMITH              20 CLERK
                                ALLEN              30 SALESMAN
                                BLAKE              30 MANAGER
                                JAMES              30 CLERK
                                MARTIN             30 SALESMAN
                                TURNER             30 SALESMAN
                                WARD               30 SALESMAN

14 rows selected.
</pre>
<p>This time the execution plan looks slightly different, as follows.</p>
<pre class="sh_oracle sh_sourceCode">&nbsp;</pre>
<pre class="output">
Rows     Row Source Operation
-------  ---------------------------------------------------
     14  SORT UNIQUE
     19   UNION-ALL
     11    HASH JOIN OUTER
     11     TABLE ACCESS FULL E2
      8     TABLE ACCESS FULL E1
      8    HASH JOIN OUTER
      8     TABLE ACCESS FULL E1
     11     TABLE ACCESS FULL E2
</pre>
<p>Oracle has used two outer joins in opposite directions to perform this query, which is in fact what we asked it to do in the way we structured our query.</p>
<p>A final point to note is that full outer joins are &quot;expensive&quot; operations and can have a fine tipping-point at which performance degrades. This point can be at relatively low volumes for some systems (especially when outer joining more than two datasets) so is something for developers to be aware of while testing.</p>
<h3 id="910dd" name="910dd">cross join</h3>
<p>A cross join is what we call a Cartesian Product in Oracle. A Cartesian Product &quot;joins&quot; each row in the first dataset to every row in the second dataset. To understand how many records are generated by a Cartesian Product or cross join, simply multiply the number of rows in the two datasets together. In the following example, we will cross join two small datasets of 2 rows each, thereby outputting 4 rows. This will keep the screen output to a minimum for demonstration purposes.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">WITH</span> two_rows <span class="sh_keyword">AS</span> <span class="sh_symbol">(</span>
  <span class="sh_number">2</span>     <span class="sh_keyword">SELECT</span> <span class="sh_number">1</span> <span class="sh_keyword">AS</span> r <span class="sh_keyword">FROM</span> dual
  <span class="sh_number">3</span>     <span class="sh_keyword">UNION</span> <span class="sh_keyword">ALL</span>
  <span class="sh_number">4</span>     <span class="sh_keyword">SELECT</span> <span class="sh_number">2</span> <span class="sh_keyword">AS</span> r <span class="sh_keyword">FROM</span> dual
  <span class="sh_number">5</span>     <span class="sh_symbol">)</span>
  <span class="sh_number">6</span>  <span class="sh_keyword">SELECT</span> a<span class="sh_symbol">.</span>r<span class="sh_symbol">,</span> b<span class="sh_symbol">.</span>r
  <span class="sh_number">7</span>  <span class="sh_keyword">FROM</span>   two_rows a
  <span class="sh_number">8</span>         <span class="sh_keyword">CROSS</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">9</span>         two_rows b<span class="sh_symbol">;</span>
</pre>
<pre class="output">
         R          R
---------- ----------
         1          1
         2          1
         1          2
         2          2

4 rows selected.
</pre>
<p>We can see that there is no join predicate with a cross join, though we can add filter predicates (WHERE clause) if required. Note how each row in dataset A has joined to both rows in dataset B. The Oracle equivalent of this syntax is as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">WITH</span> two_rows <span class="sh_keyword">AS</span> <span class="sh_symbol">(</span>
  <span class="sh_number">2</span>     <span class="sh_keyword">SELECT</span> <span class="sh_number">1</span> <span class="sh_keyword">AS</span> r <span class="sh_keyword">FROM</span> dual
  <span class="sh_number">3</span>     <span class="sh_keyword">UNION</span> <span class="sh_keyword">ALL</span>
  <span class="sh_number">4</span>     <span class="sh_keyword">SELECT</span> <span class="sh_number">2</span> <span class="sh_keyword">AS</span> r <span class="sh_keyword">FROM</span> dual
  <span class="sh_number">5</span>     <span class="sh_symbol">)</span>
  <span class="sh_number">6</span>  <span class="sh_keyword">SELECT</span> a<span class="sh_symbol">.</span>r<span class="sh_symbol">,</span> b<span class="sh_symbol">.</span>r
  <span class="sh_number">7</span>  <span class="sh_keyword">FROM</span>   two_rows a
  <span class="sh_number">8</span>  <span class="sh_symbol">,</span>      two_rows b<span class="sh_symbol">;</span>
</pre>
<pre class="output">
         R          R
---------- ----------
         1          1
         2          1
         1          2
         2          2

4 rows selected.
</pre>
<h3 id="a444e" name="a444e">mutable join</h3>
<p>Mutable joins are simply multi-table joins. These can include any combination of ANSI joins as required.</p>
<h4 id="6ce99" name="6ce99">mutable inner join</h4>
<p>We can see an example of this by joining DEPT to EMP and to EMP again as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>sal
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">6</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">7</span>         emp e2
  <span class="sh_number">8</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>empno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
DNAME          LOC           ENAME      JOB              SAL
-------------- ------------- ---------- --------- ----------
RESEARCH       DALLAS        SMITH      CLERK            800
SALES          CHICAGO       ALLEN      SALESMAN        1600
SALES          CHICAGO       WARD       SALESMAN        1250
RESEARCH       DALLAS        JONES      MANAGER         2975
SALES          CHICAGO       MARTIN     SALESMAN        1250
SALES          CHICAGO       BLAKE      MANAGER         2850
ACCOUNTING     NEW YORK      CLARK      MANAGER         2450
RESEARCH       DALLAS        SCOTT      ANALYST         3000
ACCOUNTING     NEW YORK      KING       PRESIDENT       5000
SALES          CHICAGO       TURNER     SALESMAN        1500
RESEARCH       DALLAS        ADAMS      CLERK           1100
SALES          CHICAGO       JAMES      CLERK            950
RESEARCH       DALLAS        FORD       ANALYST         3000
ACCOUNTING     NEW YORK      MILLER     CLERK           1300

14 rows selected.
</pre>
<p>In ANSI syntax, joins are parsed from left to right and join conditions can only reference preceding tables in the FROM clause. We can see this in the following example where we attempt to include a reference to the second EMP join in the first DEPT-EMP join predicates.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e<span class="sh_symbol">.</span>job<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>sal
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d
  <span class="sh_number">3</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         emp e
  <span class="sh_number">5</span>  <span class="sh_keyword">ON</span>    <span class="sh_symbol">(</span>d<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e<span class="sh_symbol">.</span>deptno
  <span class="sh_number">6</span>  <span class="sh_keyword">AND</span>    e<span class="sh_symbol">.</span>empno <span class="sh_symbol">=</span> e2<span class="sh_symbol">.</span>empno<span class="sh_symbol">)</span> <span class="sh_comment">--&lt;-- E2 has not been joined to query yet</span>
  <span class="sh_number">7</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">8</span>         emp e2
  <span class="sh_number">9</span>  <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>empno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
AND    e.empno = e2.empno) --&lt;-- E2 has not been joined to query yet
                 *
ERROR at line 6:
ORA-00904: &quot;E2&quot;.&quot;EMPNO&quot;: invalid identifier
</pre>
<p>Note that this restriction is syntactic only. It does not mean that the CBO has to physically join the datasets in the order in which they appear. To do so would render ANSI-compliant joins too restrictive. As with Oracle join syntax, the CBO is free to order the tables or datasets in the way it considers the &quot;cheapest&quot;.</p>
<p>The Oracle syntax for mutable inner joins is as follows.</p>
<pre class="sh_oracle sh_sourceCode"><span class="sh_keyword">SELECT</span> d1<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d1<span class="sh_symbol">.</span>loc<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>ename<span class="sh_symbol">,</span> e1<span class="sh_symbol">.</span>job<span class="sh_symbol">,</span> e2<span class="sh_symbol">.</span>sal
<span class="sh_keyword">FROM</span>   dept d1
<span class="sh_symbol">,</span>      emp  e1
<span class="sh_symbol">,</span>      emp  e2
<span class="sh_keyword">WHERE</span>  d1<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> e1<span class="sh_symbol">.</span>deptno
<span class="sh_keyword">AND</span>    e1<span class="sh_symbol">.</span>empno <span class="sh_symbol">=</span> e2<span class="sh_symbol">.</span>empno<span class="sh_symbol">;</span>
</pre>
<h4 id="e5762" name="e5762">mutable outer join</h4>
<p>One of the benefits of ANSI syntax is that it makes outer joins easier to write and understand. It also helps us to workaround the minor restrictions of Oracle syntax (we saw an example earlier when attempting to outer join using an expression). Another restriction with Oracle syntax is that a table can only be outer joined once in any one query block.</p>
<p>We can setup an example of this. We will create three small datasets, D1, D2 and D3, as three variations on the contents of DEPT as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">CREATE</span> <span class="sh_keyword">TABLE</span> d1 <span class="sh_keyword">AS</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span> <span class="sh_keyword">FROM</span> dept<span class="sh_symbol">;</span>
</pre>
<pre class="output">
Table created.
</pre>
<pre class="sh_oracle nopad sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">CREATE</span> <span class="sh_keyword">TABLE</span> d2 <span class="sh_keyword">AS</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span> <span class="sh_keyword">FROM</span> dept <span class="sh_keyword">WHERE</span> <span class="sh_keyword">ROWNUM</span> <span class="sh_symbol">&lt;=</span> <span class="sh_number">3</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
Table created.
</pre>
<pre class="sh_oracle nopad sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">CREATE</span> <span class="sh_keyword">TABLE</span> d3 <span class="sh_keyword">AS</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span> <span class="sh_keyword">FROM</span> dept <span class="sh_keyword">WHERE</span> <span class="sh_keyword">ROWNUM</span> <span class="sh_symbol">&lt;=</span> <span class="sh_number">2</span><span class="sh_symbol">;</span>
</pre>
<pre class="output">
Table created.
</pre>
<p>If we are required to outer join both D1 and D2 to the D3 dataset, Oracle will not allow us to use a single query block for this, as we can see below.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d1<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d1<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d2<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d3<span class="sh_symbol">.</span>deptno
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   d1
  <span class="sh_number">3</span>  <span class="sh_symbol">,</span>      d2
  <span class="sh_number">4</span>  <span class="sh_symbol">,</span>      d3
  <span class="sh_number">5</span>  <span class="sh_keyword">WHERE</span>  d1<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d3<span class="sh_symbol">.</span>deptno<span class="sh_symbol">(+)</span>
  <span class="sh_number">6</span>  <span class="sh_keyword">AND</span>    d2<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d3<span class="sh_symbol">.</span>deptno<span class="sh_symbol">(+);</span>
</pre>
<pre class="output">
WHERE  d1.deptno = d3.deptno(+)
                 *
ERROR at line 5:
ORA-01417: a table may be outer joined to at most one other table
</pre>
<p>The Oracle workaround to this is to use an in-line view for one of the outer joins, as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d1<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d1<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d2_d3<span class="sh_symbol">.</span>d2_deptno<span class="sh_symbol">,</span> d2_d3<span class="sh_symbol">.</span>d3_deptno
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   d1
  <span class="sh_number">3</span>  <span class="sh_symbol">,</span>     <span class="sh_symbol">(</span>
  <span class="sh_number">4</span>         <span class="sh_keyword">SELECT</span> d2<span class="sh_symbol">.</span>deptno <span class="sh_keyword">AS</span> d2_deptno
  <span class="sh_number">5</span>         <span class="sh_symbol">,</span>      d3<span class="sh_symbol">.</span>deptno <span class="sh_keyword">AS</span> d3_deptno
  <span class="sh_number">6</span>         <span class="sh_keyword">FROM</span>   d2
  <span class="sh_number">7</span>         <span class="sh_symbol">,</span>      d3
  <span class="sh_number">8</span>         <span class="sh_keyword">WHERE</span>  d2<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d3<span class="sh_symbol">.</span>deptno <span class="sh_symbol">(+)</span>
  <span class="sh_number">9</span>        <span class="sh_symbol">)</span> d2_d3
 <span class="sh_number">10</span>  <span class="sh_keyword">WHERE</span>  d1<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d2_d3<span class="sh_symbol">.</span>d3_deptno<span class="sh_symbol">(+);</span>
</pre>
<pre class="output">
DNAME              DEPTNO  D2_DEPTNO  D3_DEPTNO
-------------- ---------- ---------- ----------
ACCOUNTING             10         10         10
RESEARCH               20         20         20
SALES                  30
OPERATIONS             40

4 rows selected.
</pre>
<p>ANSI syntax makes this easier as we can combine left and right outer joins in a single query as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> d1<span class="sh_symbol">.</span>dname<span class="sh_symbol">,</span> d1<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d2<span class="sh_symbol">.</span>deptno<span class="sh_symbol">,</span> d3<span class="sh_symbol">.</span>deptno
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   d2
  <span class="sh_number">3</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">4</span>         d3
  <span class="sh_number">5</span>         <span class="sh_keyword">ON</span> <span class="sh_symbol">(</span>d2<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d3<span class="sh_symbol">.</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">6</span>         <span class="sh_keyword">RIGHT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">7</span>         d1
  <span class="sh_number">8</span>         <span class="sh_keyword">ON</span> <span class="sh_symbol">(</span>d1<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d3<span class="sh_symbol">.</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
DNAME              DEPTNO     DEPTNO     DEPTNO
-------------- ---------- ---------- ----------
ACCOUNTING             10         10         10
RESEARCH               20         20         20
SALES                  30
OPERATIONS             40

4 rows selected.
</pre>
<h4 id="f881a" name="f881a">mixed mutable joins</h4>
<p>Finally, mutable joins can combine any of the ANSI joins. For completeness, we will run a query that combines everything we&#8217;ve seen in this article. The results will be completely useless of course!</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_keyword">COUNT</span><span class="sh_symbol">(*)</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   dept d1
  <span class="sh_number">3</span>         <span class="sh_comment">--</span>
  <span class="sh_number">4</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">5</span>         dept d2
  <span class="sh_number">6</span>         <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">7</span>         <span class="sh_comment">--</span>
  <span class="sh_number">8</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">9</span>         emp  e1
 <span class="sh_number">10</span>         <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">)</span>
 <span class="sh_number">11</span>         <span class="sh_comment">--</span>
 <span class="sh_number">12</span>         <span class="sh_keyword">RIGHT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
 <span class="sh_number">13</span>         emp  e2
 <span class="sh_number">14</span>         <span class="sh_keyword">ON</span> <span class="sh_symbol">(</span>e1<span class="sh_symbol">.</span>empno <span class="sh_symbol">=</span> e2<span class="sh_symbol">.</span>empno<span class="sh_symbol">)</span>
 <span class="sh_number">15</span>         <span class="sh_comment">--</span>
 <span class="sh_number">16</span>         <span class="sh_keyword">NATURAL</span> <span class="sh_keyword">JOIN</span>
 <span class="sh_number">17</span>         emp  e3
 <span class="sh_number">18</span>         <span class="sh_comment">--</span>
 <span class="sh_number">19</span>         <span class="sh_keyword">CROSS</span> <span class="sh_keyword">JOIN</span>
 <span class="sh_number">20</span>         dept d4<span class="sh_symbol">;</span>
</pre>
<pre class="output">
  COUNT(*)
----------
       784

1 row selected.
</pre>
<h3 id="21e26" name="21e26">ansi joins and the cbo</h3>
<p>As we saw in the mutable joins section, the ANSI FROM syntax is ordered from left-to-right and datasets/tables are added and joined to the query one-by-one. While this implies an explicit ordering in the application of join predicates to the SQL, this does not mean that this is how the optimiser (CBO) will deal with the joins. As with queries that use standard Oracle syntax, the CBO is free to shuffle the join orders according to its own costs and arithmetic.</p>
<p>In most cases, the execution plans for equivalent ANSI and Oracle syntax queries will be the same as they are based on the same underlying statistics. The obvious exception to this is the FULL OUTER JOIN that we saw earlier, though we could code an Oracle equivalent based on what we now know about Oracle&#8217;s treatment of the new ANSI method.</p>
<p>To demonstrate that the order of the ANSI joins does not dictate the actual join order chosen by the CBO, we will run a simple example that joins the D1, D2 and D3 sample tables created earlier in this article. Using Autotrace, we will first see how Oracle might choose to optimise such a query written with ANSI joins as follows.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">set</span> <span class="sh_type">autotrace</span> <span class="sh_keyword">traceonly</span> <span class="sh_keyword">explain</span>

SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   d1
  <span class="sh_number">3</span>         <span class="sh_comment">--</span>
  <span class="sh_number">4</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">5</span>         d2
  <span class="sh_number">6</span>         <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">7</span>         <span class="sh_comment">--</span>
  <span class="sh_number">8</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">9</span>         d3
 <span class="sh_number">10</span>         <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=8 Card=3 Bytes=180)
   1    0   HASH JOIN (Cost=8 Card=3 Bytes=180)
   2    1     HASH JOIN (OUTER) (Cost=5 Card=3 Bytes=120)
   3    2       TABLE ACCESS (FULL) OF 'D2' (Cost=2 Card=3 Bytes=57)
   4    2       TABLE ACCESS (FULL) OF 'D3' (Cost=2 Card=2 Bytes=42)
   5    1     TABLE ACCESS (FULL) OF 'D1' (Cost=2 Card=4 Bytes=80)
</pre>
<p>We can see that the Explain Plan join order does not match the order of the tables in our SQL. The CBO has started with the LEFT OUTER JOIN between D2 and D3, hashing D3 first. If we write this statement using Oracle syntax, we can verify that the optimiser treats it the same as the ANSI equivalent.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_symbol">*</span>
  <span class="sh_number">2</span>  <span class="sh_keyword">FROM</span>   d1
  <span class="sh_number">3</span>  <span class="sh_symbol">,</span>      d2
  <span class="sh_number">4</span>  <span class="sh_symbol">,</span>      d3
  <span class="sh_number">5</span>  <span class="sh_keyword">WHERE</span>  d1<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d2<span class="sh_symbol">.</span>deptno
  <span class="sh_number">6</span>  <span class="sh_keyword">AND</span>    d2<span class="sh_symbol">.</span>deptno <span class="sh_symbol">=</span> d3<span class="sh_symbol">.</span>deptno <span class="sh_symbol">(+);</span>
</pre>
<pre class="output">
Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=8 Card=3 Bytes=180)
   1    0   HASH JOIN (Cost=8 Card=3 Bytes=180)
   2    1     HASH JOIN (OUTER) (Cost=5 Card=3 Bytes=120)
   3    2       TABLE ACCESS (FULL) OF 'D2' (Cost=2 Card=3 Bytes=57)
   4    2       TABLE ACCESS (FULL) OF 'D3' (Cost=2 Card=2 Bytes=42)
   5    1     TABLE ACCESS (FULL) OF 'D1' (Cost=2 Card=4 Bytes=80)
</pre>
<p>Finally, we can add a hint to change the order in which we wish the CBO to join the tables. In the following example, we will try to force the CBO to begin with the D1 table by using the LEADING hint.</p>
<pre class="sh_oracle sh_sourceCode">
SQL<span class="sh_symbol">&gt;</span> <span class="sh_keyword">SELECT</span> <span class="sh_comment">/*+ LEADING(d1) */</span>
  <span class="sh_number">2</span>         <span class="sh_symbol">*</span>
  <span class="sh_number">3</span>  <span class="sh_keyword">FROM</span>   d1
  <span class="sh_number">4</span>         <span class="sh_comment">--</span>
  <span class="sh_number">5</span>         <span class="sh_keyword">INNER</span> <span class="sh_keyword">JOIN</span>
  <span class="sh_number">6</span>         d2
  <span class="sh_number">7</span>         <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">)</span>
  <span class="sh_number">8</span>         <span class="sh_comment">--</span>
  <span class="sh_number">9</span>         <span class="sh_keyword">LEFT</span> <span class="sh_keyword">OUTER</span> <span class="sh_keyword">JOIN</span>
 <span class="sh_number">10</span>         d3
 <span class="sh_number">11</span>         <span class="sh_keyword">USING</span> <span class="sh_symbol">(</span>deptno<span class="sh_symbol">);</span>
</pre>
<pre class="output">
Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=8 Card=3 Bytes=180)
   1    0   HASH JOIN (OUTER) (Cost=8 Card=3 Bytes=180)
   2    1     HASH JOIN (Cost=5 Card=3 Bytes=117)
   3    2       TABLE ACCESS (FULL) OF 'D1' (Cost=2 Card=4 Bytes=80)
   4    2       TABLE ACCESS (FULL) OF 'D2' (Cost=2 Card=3 Bytes=57)
   5    1     TABLE ACCESS (FULL) OF 'D3' (Cost=2 Card=2 Bytes=42)
</pre>
<p>This time, Explain Plan tells us that the CBO would start with D1 as we requested and the outer join is performed after D1 and D2 are hash joined.</p>
<h3 id="7149c" name="7149c">further reading</h3>
<p>For more information on ANSI join syntax, see the documentation for SELECT in the online <a href="http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_103a.htm#2065648">SQL Reference</a>.</p>
<h3 id="code" name="code">source code</h3>
<p>The source code for the examples in this article can be downloaded from <a href="http://loopback.pe.kr/content/code/213.zip">here</a>.</p>
<p class="signature">Adrian Billington, January 2003 (updated June 2007)</p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/523/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>아이폰으로 서버를&#8230;</title>
		<link>http://loopback.pe.kr/wordpress/archives/521</link>
		<comments>http://loopback.pe.kr/wordpress/archives/521#comments</comments>
		<pubDate>Fri, 13 May 2011 07:44:31 +0000</pubDate>
		<dc:creator>내요</dc:creator>
				<category><![CDATA[DEVELOPMENT]]></category>

		<guid isPermaLink="false">http://loopback.pe.kr/wordpress/?p=521</guid>
		<description><![CDATA[얼마전 무제한요금제로 바꾼것과 회사내에서 와이파이를 사용할 수 없다는 이유로 현재 대부분 와이파일를 꺼놓고 삽니다.
아이폰도 리눅스인지라 평소에도 자주 들어가서 이런저런것을 해보곤 하는데
3G 데이타 아이피로는 ssh접속이 안되는는 불상사가&#8230;
여러가지 삽질끝에 결론은 KT에서 특정 포트(아마도 1024이하)는 접속하지 못하게 막은것 같아서
예전에 만든 tn프로그램을 좀더 개량해서 아이폰에서 컴파일했고 9999포트를 열어 22번포트로 보내는 작업을&#160;했습니다.
지금 생각하면&#160;putty로 해볼껄&#8230; 하지만 나중에 해보기로 하고
더불어 dyndns.com에 무료 [...]]]></description>
			<content:encoded><![CDATA[<p>얼마전 무제한요금제로 바꾼것과 회사내에서 와이파이를 사용할 수 없다는 이유로 현재 대부분 와이파일를 꺼놓고 삽니다.</p>
<p>아이폰도 리눅스인지라 평소에도 자주 들어가서 이런저런것을 해보곤 하는데</p>
<p>3G 데이타 아이피로는 ssh접속이 안되는는 불상사가&#8230;</p>
<p>여러가지 삽질끝에 결론은 KT에서 특정 포트(아마도 1024이하)는 접속하지 못하게 막은것 같아서</p>
<p>예전에 만든 tn프로그램을 좀더 개량해서 아이폰에서 컴파일했고 9999포트를 열어 22번포트로 보내는 작업을&nbsp;했습니다.</p>
<p>지금 생각하면&nbsp;putty로 해볼껄&#8230; 하지만 나중에 해보기로 하고</p>
<p>더불어 dyndns.com에 무료 호스트를 추가하고 inadyn(<a href="https://www.dyndns.com/support/clients/unix.html">https://www.dyndns.com/support/clients/unix.html</a>)로 아이피를 연결했습니다.</p>
<p>관심있으신분은 댓글로&nbsp;남기면 자세한 내용을 알려드리겠습니다.</p>
<p>한달에 한 10명쯤 방문하려나&#8230;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://loopback.pe.kr/wordpress/archives/521/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

