<?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>UKoom &#187; Oracle</title>
	<atom:link href="http://www.ukoom.com/tag/oracle/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ukoom.com</link>
	<description>Documentum, SharePoint, Alfresco, ECM...</description>
	<lastBuildDate>Tue, 25 Oct 2011 15:11:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Register table issue caused by using wrong column type in SQL</title>
		<link>http://www.ukoom.com/register-table-issue-caused-by-using-wrong-column-type-in-sql.htm</link>
		<comments>http://www.ukoom.com/register-table-issue-caused-by-using-wrong-column-type-in-sql.htm#comments</comments>
		<pubDate>Tue, 07 Dec 2010 03:54:26 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Documentum]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=1127</guid>
		<description><![CDATA[Wow, how long the title is! I came across one strange issue today (actually I found this last Friday, but you know weekend coming, hehehe). When using the update DQL to fill up one new column in the registered table, there are always lots of blanks appended. The root cause after doing some investigation, what [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, how long the title is! <img src='http://www.ukoom.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I came across one strange issue today (actually I found this last Friday, but you know weekend coming, hehehe).</p>
<p>When using the update DQL to fill up one new column in the registered table, there are always lots of blanks appended.</p>
<p>The root cause after doing some investigation, what I found:</p>
<p>We are adding the column in type &#8211; char rather than varchar2 which is the normal one.</p>
<p>CHAR should be used for storing <span style="font-weight: bold;">fix length character strings</span>. String values will be <span style="font-weight: bold;">space/blank padded</span> before stored on disk.</p>
<p>Baiqing, one of my colleges , wrote the DQL to add the new column. I believe that:</p>
<p>1. He should be more careful <img src='http://www.ukoom.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>2. The DQL used to register table in Documentum are defining the type as &#8216;char&#8217;. Documentum is using &#8216;char&#8217; type to define <span style="font-weight: bold;">variable length character strings. </span>there is no type to define fix length strings. That make developer confused.</p>
<p>Anyway, the cause was found. Happy Monday!!!!</p>
<p>Reference:</p>
<p>http://www.orafaq.com/faq/what_is_the_difference_between_varchar_varchar2_and_char_data_types</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/register-table-issue-caused-by-using-wrong-column-type-in-sql.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get definition for view in Oracle</title>
		<link>http://www.ukoom.com/get-definition-for-view-in-oracle.htm</link>
		<comments>http://www.ukoom.com/get-definition-for-view-in-oracle.htm#comments</comments>
		<pubDate>Fri, 23 Apr 2010 01:19:36 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=1059</guid>
		<description><![CDATA[set LONG 10000 select TEXT from ALL_VIEWS where view_name = &#8216;MY_VIEW&#8216;; Line one must be at least the size of the statement used to create the view. Either pick a really big number if you think the view is large or use the following to determine how long it is first. If it isn&#8217;t, the [...]]]></description>
			<content:encoded><![CDATA[<div><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">set  LONG 1000<span>0</span><br />
select TEXT from ALL_VIEWS  where  view_name<span> </span>=<span> </span>&#8216;<span>MY_VIEW</span>&#8216;;</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;">Line one must be at  least the size of the statement used to  create the view. Either pick a really  big number if you think the view  is large or use the following to determine how  long it is first. If it  isn&#8217;t, the text will be truncated</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">select   text_length from all_views where view_name = &#8216;MY_VIEW&#8217;</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;">NOTE: name of the  view is case sensitive as are most every thing  in Oracle.</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;">If you want to  capture output to something other than a SQL Plus  window such as a file, be sure  to include do the following before you  execute the select  statement.</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">spool   c:\v_person.sql</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;">To close the file  when you  are done writing output to it, call the following:</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">spool   off</span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"><strong> </strong></span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"><strong>To  summarize:</strong></span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"> </span></span></div>
<div><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">select text_length from all_views where   view_name = &#8216;MY_VIEW&#8217;</span></span></span></div>
<div><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">10000</span></span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"><span> </span></span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"><span>&#8211; whatever value you  get back, use on the next  statement.</span></span></span></div>
<div><span><span style="font-family: Arial; font-size: 85%;"><span> </span></span></span></div>
<div><span><span><span><span style="font-family: Arial;"><span style="font-size: 85%;"><span style="color: #0000ff;">set  LONG  1000<span>0</span></span></span></span></span></span></span></div>
<div><span><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;"><span> </span></span></span></span></span></div>
<div><span><span><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">spool  c:\v_person.sql</span></span></span></span></span></div>
<div><span><span><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;"> </span></span></span></span></span></div>
<div><span><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;"><span>select TEXT from ALL_VIEWS where view_name<span> </span>=<span> </span>&#8216;<span>MY_VIEW</span>&#8216;;</span></span></span></span></span></div>
<div><span><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;"><span> </span></span></span></span></span></div>
<div><span><span><span><span><span style="font-family: Arial; font-size: 85%; color: #0000ff;">spool off</span></span></span></span></span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/get-definition-for-view-in-oracle.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install oracle-10.2.0.3 and Documentum-6.5</title>
		<link>http://www.ukoom.com/install-oracle-10-2-0-3-and-documentum-6-5-doc.htm</link>
		<comments>http://www.ukoom.com/install-oracle-10-2-0-3-and-documentum-6-5-doc.htm#comments</comments>
		<pubDate>Mon, 28 Dec 2009 03:49:17 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Documentum]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=990</guid>
		<description><![CDATA[The whole process is installing oracle 10.2.0.1 first then updating it to 10.2.0.3 You can follow this article step by step: http://www.itpub.net/viewthread.php?tid=806933&#38;extra=&#38;page=1 Note: I was installing oracle in RedHat Enterprise Linux 4 Update 3, the only missing package is gcc.You can get help from this page: http://hi.baidu.com/thinkinginlamp/blog/item/f91ad1138ac429025aaf53e2.html If you are installing oracle in linux OS [...]]]></description>
			<content:encoded><![CDATA[<p>The whole process is installing oracle 10.2.0.1 first then updating it to 10.2.0.3</p>
<p>You can follow this article step by step:</p>
<p><a href="http://www.itpub.net/viewthread.php?tid=806933&amp;extra=&amp;page=1">http://www.itpub.net/viewthread.php?tid=806933&amp;extra=&amp;page=1</a></p>
<p>Note:</p>
<ol>
<li>I was installing oracle in RedHat Enterprise Linux 4 Update 3, the only missing package is gcc.You can get help from this page:</li>
</ol>
<p><a href="http://hi.baidu.com/thinkinginlamp/blog/item/f91ad1138ac429025aaf53e2.html">http://hi.baidu.com/thinkinginlamp/blog/item/f91ad1138ac429025aaf53e2.html</a></p>
<ol>
<li>If you are installing oracle in linux OS which doesn’t have language Chinese installed, then you should not set environment variable NLS_LANG mentioned in the above article.</li>
<li>After update oracle to 10.2.0.3, you should run the following sql statements to upgrade data dictionary: (go to folder ORACLE_HOME, then startup sqlplus)</li>
</ol>
<p>SQL&gt; STARTUP UPGRADE<br />
$K&#8221;qE5x[1]e.gd&#8217;rO0SQL&gt; @?\rdbms\admin\catupgrd.sql</p>
<p>SQL&gt;@?\rdbms\admin\utlrp.sqlITPUB个人空间F/`Q Q.qu7yqOITPUB个人空间i5y(D*zT&#8217;?</p>
<p><strong>Install Documentum Content server 6.5</strong></p>
<p>The main resource is ContentServerInstallGuide_6.5.pdf.</p>
<ol>
<li>Follow chapter <em>Required Environment Variables for UNIX and Linux </em>and chapter<em> Preparing the Database for Content Server Installation</em> to set all required environment variables.</li>
<li>Copy files tnsnamse.ora and listener.ora from $ORACLE_HOME/network/admin to $TNS_ADMIN</li>
<li>Follow chapter <em>Installing content Server</em> to install content server and create docbase and docbroker.</li>
</ol>
<p><strong>Appendix A: How to start/stop oracle:</strong></p>
<p><a href="http://hua6884858.javaeye.com/blog/441251">http://hua6884858.javaeye.com/blog/441251</a></p>
<p><strong>Appendix B: How to start/stop docbase/docbroker:</strong></p>
<p>All the shell file is located in $DOCUMENTUM/dba</p>
<p>Such as dm_launch_&lt;Docbroker-name&gt;, dm_stop_&lt;Docbroker-name&gt;, dm_start_&lt;Dobase-name&gt;, dm_shutdown_&lt;Docbase-name&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/install-oracle-10-2-0-3-and-documentum-6-5-doc.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>spool命令和使用select语句批量动态生成sql语句</title>
		<link>http://www.ukoom.com/spool%e5%91%bd%e4%bb%a4%e5%92%8c%e4%bd%bf%e7%94%a8select%e8%af%ad%e5%8f%a5%e6%89%b9%e9%87%8f%e6%8b%bc%e8%a3%85sql%e8%af%ad%e5%8f%a5.htm</link>
		<comments>http://www.ukoom.com/spool%e5%91%bd%e4%bb%a4%e5%92%8c%e4%bd%bf%e7%94%a8select%e8%af%ad%e5%8f%a5%e6%89%b9%e9%87%8f%e6%8b%bc%e8%a3%85sql%e8%af%ad%e5%8f%a5.htm#comments</comments>
		<pubDate>Fri, 27 Nov 2009 07:16:45 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=858</guid>
		<description><![CDATA[今天一个任务是从两张表中用sql语句导出些数据，并且提交这些数据的插入语句。上网查询后找到个方法，例子如下： spool c:\data.sql; select &#8216;insert into table_name values(&#8221;&#8217;&#124;&#124;field_1&#124;&#124;&#8221;&#8217;,&#8221;&#8217;&#124;&#124;field_2&#124;&#124;&#8221;&#8217;);&#8217;from table_name where field_n=some_conditon; spool off; 从这个方案中引申学到两条：spool命令和使用select语句批量拼装sql语句 spool命令 1 Oracle的spool命令可以用来将数据export出来到文本文件。Oracle的Import/Export命令用于备份和恢复比较有效，但对于一些临时数据量的导出，Export不好用，甚至不可用。在这里，就是spool的发挥之地了。 2Spool一般使用格式为spool [filepath]filename;       其他sql语句；spool off; 要输出的内容都在spool语句中包含； 3 spool还有些其他控制命令： set pagesize 0               &#8211;设置页面大小， 0表示无限制，如果设置为10,则10行数据后出现一空行 set num 18                  &#8211;设置数字的长度，如果不够大，则用科学记数法显示 set heading off             &#8211;设置不要题头，则不出现select的field list set feedback off           &#8211;设置不需要返回信息， 比如&#8221; 100 rows selected“ set term off                 &#8211; set trimspool on           &#8211;trim 4 如果在sqlplus中直接使用sql语句，则导出的数据文件中会包含spool语句中使用的sql语句，如果不想让生成这些可把要使用的sql语句存在一个文件中再在sqlplus中执行此文件即可。 [...]]]></description>
			<content:encoded><![CDATA[<p>今天一个任务是从两张表中用sql语句导出些数据，并且提交这些数据的插入语句。上网查询后找到个方法，例子如下：<br />
spool c:\data.sql;<br />
select &#8216;insert into table_name values(&#8221;&#8217;||field_1||&#8221;&#8217;,&#8221;&#8217;||field_2||&#8221;&#8217;);&#8217;from table_name where field_n=some_conditon;<br />
spool off;<br />
从这个方案中引申学到两条：spool命令和使用select语句批量拼装sql语句</p>
<ol>
<li>spool命令</li>
</ol>
<p>1 Oracle的spool命令可以用来将数据export出来到文本文件。Oracle的Import/Export命令用于备份和恢复比较有效，但对于一些临时数据量的导出，Export不好用，甚至不可用。在这里，就是spool的发挥之地了。</p>
<p>2Spool一般使用格式为spool [filepath]filename;       其他sql语句；spool off;</p>
<p>要输出的内容都在spool语句中包含；</p>
<p>3 spool还有些其他控制命令：</p>
<p>set pagesize 0               &#8211;设置页面大小， 0表示无限制，如果设置为10,则10行数据后出现一空行<br />
set num 18                  &#8211;设置数字的长度，如果不够大，则用科学记数法显示<br />
set heading off             &#8211;设置不要题头，则不出现select的field list<br />
set feedback off           &#8211;设置不需要返回信息， 比如&#8221; 100 rows selected“<br />
set term off                 &#8211;<br />
set trimspool on           &#8211;trim</p>
<p>4 如果在sqlplus中直接使用sql语句，则导出的数据文件中会包含spool语句中使用的sql语句，如果不想让生成这些可把要使用的sql语句存在一个文件中再在sqlplus中执行此文件即可。</p>
<ol>
<li>使用select语句批量拼装sql语句</li>
</ol>
<p>仿照select &#8216;insert into table_name values(&#8221;&#8217;||field_1||&#8221;&#8217;,&#8221;&#8217;||field_2||&#8221;&#8217;);&#8217;from table_name where field_n=some_conditon;可联想批量生成其他sql语句，例如drop、update、delete语句。其中||为连接符号，三个单引号最后生成一个单引号。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/spool%e5%91%bd%e4%bb%a4%e5%92%8c%e4%bd%bf%e7%94%a8select%e8%af%ad%e5%8f%a5%e6%89%b9%e9%87%8f%e6%8b%bc%e8%a3%85sql%e8%af%ad%e5%8f%a5.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link to Oracle Database</title>
		<link>http://www.ukoom.com/link-to-oracle-database.htm</link>
		<comments>http://www.ukoom.com/link-to-oracle-database.htm#comments</comments>
		<pubDate>Wed, 18 Nov 2009 05:01:07 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Team Fight]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/link-to-oracle-database.htm</guid>
		<description><![CDATA[sqlplus user/pass@//IP:PORT/service]]></description>
			<content:encoded><![CDATA[<p>sqlplus user/pass@//IP:PORT/service</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/link-to-oracle-database.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CREATE DATABASE LINK</title>
		<link>http://www.ukoom.com/create-database-link.htm</link>
		<comments>http://www.ukoom.com/create-database-link.htm#comments</comments>
		<pubDate>Mon, 17 Aug 2009 18:14:13 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=697</guid>
		<description><![CDATA[Use the CREATE DATABASE LINK statement to create a database link. A database link is a schema object in one database that enables you to access objects on another database. The other database need not be an Oracle Database system. However, to access non-Oracle systems you must use Oracle Heterogeneous Services. After you have created [...]]]></description>
			<content:encoded><![CDATA[<p><a id="sthref4977" name="sthref4977"></a><a id="sthref4978" name="sthref4978"></a><a id="sthref4979" name="sthref4979"></a><a id="sthref4980" name="sthref4980"></a>Use the <code>CREATE</code> <code>DATABASE</code> <code>LINK</code> statement to create a database link. A <span class="bold">database link</span> is a schema object in one database that enables you to access objects on another database. The other database need not be an Oracle Database system. However, to access non-Oracle systems you must use Oracle Heterogeneous Services.</p>
<p>After you have created a database link, you can use it to refer to tables and views on the other database. In SQL statements, you can refer to a table or view on the other database by appending <code><span class="codeinlineitalic">@dblink</span></code> to the table or view name. You can query a table or view on the other database with the <code>SELECT</code> statement. You can also access remote tables and views using any <code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>, or <code>LOCK</code> <code>TABLE</code> statement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/create-database-link.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time zone and timestamp in Oracle</title>
		<link>http://www.ukoom.com/time-zone-and-timestamp-in-oracle.htm</link>
		<comments>http://www.ukoom.com/time-zone-and-timestamp-in-oracle.htm#comments</comments>
		<pubDate>Fri, 12 Jun 2009 11:12:08 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=89</guid>
		<description><![CDATA[There are two kinds of timezone: 1. DBTIMEZONE you can set the time zone for database by &#8220;alter database set time_zone=&#8217;+08:00&#8242;&#8221;. To make this take effect, you should reboot the database. But if you have a column that is of TIMESTAMP WITH TIME ZONE/LOCAL TIME ZONE, you will not be able to change the DBTIMEZONE. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ukoom.com/wp-content/uploads/2008/11/oracle.jpg"><img class="alignnone size-medium wp-image-162" title="oracle" src="http://www.ukoom.com/wp-content/uploads/2008/11/oracle-300x193.jpg" alt="" width="300" height="193" /></a></p>
<p>There are two kinds of timezone:</p>
<p>1. DBTIMEZONE you can set the time zone for database by &#8220;alter database set time_zone=&#8217;+08:00&#8242;&#8221;. To make<br />
this take effect, you should reboot the database. But if you have a column that is of TIMESTAMP WITH TIME ZONE/LOCAL TIME ZONE, you will not be able to change the DBTIMEZONE. SYSTIMESTAMP is used to get the current database timestamp with time zone information. BTW, SYSDATE is used to get the current date without time zone information.</p>
<p>2. SESSIONTIMEZONE you can set time zone at the session level<br />
e.g. you can issue &#8220;alter session set TIME_ZONE=&#8217;+08::00&#8242;;&#8221; to change the timezone for current session. CURRENT_TIMESTAMP is used to get the current session timestamp with time zone infomation.</p>
<p>There are three types of timestamp:</p>
<p>1. timestamp</p>
<p>2. timestamp with time zone</p>
<p>3. timestamp with local time zone</p>
<p>The key point is &#8220;The main idea to grasp here is that the column with datatype TIMESTAMP WITH TIME ZONE stores and displays the explicit time supplied from the INSERT statement. The column with datatype TIMESTAMP WITH LOCAL TIME ZONE stores the explicit time supplied but will display a value that is relative to the current session time zone. This means that if you want hard and fast TIMESTAMPS with time zone information stored, you should use the TIMESTAMP WITH TIME ZONE datatype. If you are concerned more with giving date and time information to customers in different time zones and represented in their local time, you should use the TIMESTAMP WITH LOCAL TIME ZONE datatype.&#8221;</p>
<p>references:</p>
<p>http://www.dbasupport.com/oracle/ora9i/TimeZone.shtml</p>
<p>http://toolkit.rdbms-insight.com/tz.php</p>
<p>P.S. you can get all valid timezone name by &#8220;select tzname, tzabbrev from V$TIMEZONE_NAMES&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/time-zone-and-timestamp-in-oracle.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle In and Exist</title>
		<link>http://www.ukoom.com/oracle-in-an-exist.htm</link>
		<comments>http://www.ukoom.com/oracle-in-an-exist.htm#comments</comments>
		<pubDate>Mon, 06 Apr 2009 02:08:57 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=605</guid>
		<description><![CDATA[Oracle In vs Exist the two are processed very very differently. Select * from T1 where x in ( select y from T2 ) is typically processed as: select * from t1, ( select distinct y from t2 ) t2 where t1.x = t2.y; The subquery is evaluated, distinct&#8217;ed, indexed (or hashed or sorted) and [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle In vs Exist<br />
the two are processed very very differently.</p>
<p>Select * from T1 where x in ( select y from T2 )</p>
<p>is typically processed as:</p>
<p>select *<br />
from t1, ( select distinct y from t2 ) t2<br />
where t1.x = t2.y;</p>
<p>The subquery is evaluated, distinct&#8217;ed, indexed (or hashed or sorted) and then joined to<br />
the original table &#8212; typically.</p>
<p>As opposed to</p>
<p>select * from t1 where exists ( select null from t2 where y = x )</p>
<p>That is processed more like:</p>
<p>for x in ( select * from t1 )<br />
loop<br />
if ( exists ( select null from t2 where y = x.x )<br />
then<br />
OUTPUT THE RECORD<br />
end if<br />
end loop</p>
<p>It always results in a full scan of T1 whereas the first query can make use of an index<br />
on T1(x).</p>
<p>So, when is where exists appropriate and in appropriate?</p>
<p>Lets say the result of the subquery<br />
( select y from T2 )</p>
<p>is &#8220;huge&#8221; and takes a long time.  But the table T1 is relatively small and executing (<br />
select null from t2 where y = x.x ) is very very fast (nice index on t2(y)).  Then the<br />
exists will be faster as the time to full scan T1 and do the index probe into T2 could be<br />
less then the time to simply full scan T2 to build the subquery we need to distinct on.</p>
<p>Lets say the result of the subquery is small &#8212; then IN is typicaly more appropriate.</p>
<p>If both the subquery and the outer table are huge &#8212; either might work as well as the<br />
other &#8212; depends on the indexes and other factors.</p>
<p>This is from:</p>
<p>http://asktom.oracle.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/oracle-in-an-exist.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle CURSOR FOR Loop</title>
		<link>http://www.ukoom.com/oracle-cursor-for-loop.htm</link>
		<comments>http://www.ukoom.com/oracle-cursor-for-loop.htm#comments</comments>
		<pubDate>Mon, 06 Apr 2009 00:41:44 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=603</guid>
		<description><![CDATA[Syntax: FOR record_index in cursor_name LOOP {.statements.} END LOOP; You would use a CURSOR FOR Loop when you want to fetch and process every record in a cursor. The CURSOR FOR Loop will terminate when all of the records in the cursor have been fetched. Here is an example of a function that uses a [...]]]></description>
			<content:encoded><![CDATA[<p>Syntax:</p>
<p>FOR record_index in cursor_name<br />
LOOP<br />
{.statements.}<br />
END LOOP;</p>
<p>You would use a CURSOR FOR Loop when you want to fetch and process every record in a cursor. The CURSOR FOR Loop will terminate when all of the records in the cursor have been fetched.</p>
<p>Here is an example of a function that uses a CURSOR FOR Loop:</p>
<p>CREATE OR REPLACE Function TotalIncome<br />
( name_in IN varchar2 )<br />
RETURN varchar2<br />
IS<br />
total_val number(6);<br />
cursor c1 is<br />
select monthly_income<br />
from employees<br />
where name = name_in;<br />
BEGIN<br />
total_val := 0;<br />
FOR employee_rec in c1<br />
LOOP<br />
total_val := total_val + employee_rec.monthly_income;<br />
END LOOP;<br />
RETURN total_val;<br />
END;</p>
<p>In this example, we&#8217;ve created a cursor called c1. The CURSOR FOR Loop will terminate after all records have been fetched from the cursor c1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/oracle-cursor-for-loop.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DROP MATERIALIZED VIEW</title>
		<link>http://www.ukoom.com/drop-materialized-view.htm</link>
		<comments>http://www.ukoom.com/drop-materialized-view.htm#comments</comments>
		<pubDate>Fri, 27 Mar 2009 00:32:16 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=595</guid>
		<description><![CDATA[When you drop a materialized view, Oracle Database does not place it in the recycle bin. Therefore, you cannot subsequently either purge or undrop the materialized view. The keyword SNAPSHOT is supported in place of MATERIALIZED VIEW for backward compatibility. Prerequisites The materialized view must be in your own schema or you must have the [...]]]></description>
			<content:encoded><![CDATA[<p>When you drop a materialized view, Oracle Database does not place it in the recycle bin. Therefore, you cannot subsequently either purge or undrop the materialized view.</p>
<p>The keyword <code>SNAPSHOT</code> is supported in place of <code>MATERIALIZED</code> <code>VIEW</code> for backward compatibility.</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; color: #330099;">Prerequisites</span></strong></p>
<p>The materialized view must be in your own schema or you must have the <code>DROP</code> <code>ANY</code> <code>MATERIALIZED</code> <code>VIEW</code> system privilege. You must also have the privileges to drop the internal table, views, and index that the database uses to maintain the materialized view data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/drop-materialized-view.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

