﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-即兴的灵感-随笔分类-Oracle</title><link>http://www.blogjava.net/improviser/category/26128.html</link><description>思维是一种艺术，艺术需要灵感</description><language>zh-cn</language><lastBuildDate>Sun, 04 Nov 2007 18:54:44 GMT</lastBuildDate><pubDate>Sun, 04 Nov 2007 18:54:44 GMT</pubDate><ttl>60</ttl><item><title>Oracle之函数与触发器</title><link>http://www.blogjava.net/improviser/archive/2007/10/05/150456.html</link><dc:creator>improviser</dc:creator><author>improviser</author><pubDate>Thu, 04 Oct 2007 16:04:00 GMT</pubDate><guid>http://www.blogjava.net/improviser/archive/2007/10/05/150456.html</guid><wfw:comment>http://www.blogjava.net/improviser/comments/150456.html</wfw:comment><comments>http://www.blogjava.net/improviser/archive/2007/10/05/150456.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/improviser/comments/commentRss/150456.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/improviser/services/trackbacks/150456.html</trackback:ping><description><![CDATA[   <font color="#000080" size="4"> 今天写有关Oracle中函数与触发器的内容，在数据库中定义并使用存储过程、函数、触发器，可以提高用户访问数据库的效率。<br /><br />    数据库中函数包含四个部分：<b>声明、返回值、函数体和异常处理</b>。</font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> getname(sno </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar2</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">is</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">        name </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">12</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> ename </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> name </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> emp </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> empno</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">sno;<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> name;<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"> exception<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">       ...</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);"></span></div><br />   <font color="#000080"></font><font size="4"><font color="#000080">触发器是一种特殊的存储过程，类似于其它编程语言中的事件函数，允许为 INSERT、UPDATE、DELETE 创建触发器，当在表（视图）中插入、更新、删除记录(前、后)时，触发一个或一系列 T-SQL 语句。</font><span style="font-family: 宋体; color: blue;"><br /><br />    创建在</span><span style="color: blue;" lang="EN-US">STUDENT</span><span style="font-family: 宋体; color: blue;">表上的插入触发器，当在</span><span style="color: blue;" lang="EN-US">STUDENT</span><span style="font-family: 宋体; color: blue;">表中插入数据时候触发器将被触发，执行体将被执行</span></font><span style="color: blue;" lang="EN-US"><o:p></o:p></span><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">   插入触发器<br /> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">trigger</span><span style="color: rgb(0, 0, 0);"> tg_insert<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"> before </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">on</span><span style="color: rgb(0, 0, 0);"> student                </span><span style="color: rgb(128, 128, 128);">－－</span><span style="color: rgb(0, 0, 0);">可设置在插入前或插入后<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">       ...</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> <br /><br /></span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 128);">   </span><span style="color: rgb(0, 0, 0);">更新触发器<br /></span><span style="color: rgb(0, 128, 128);"> 8</span>  <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">trigger</span><span style="color: rgb(0, 0, 0);"> tg_update<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"> after </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">on</span><span style="color: rgb(0, 0, 0);"> student<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> each row </span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">     ...</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">END</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);"></span></div><br /><p class="MsoNormal" style="margin-left: 21pt;"><font size="4"><b style=""><span style="font-family: 宋体; color: blue;">触发器两个特殊行级变量：</span><span style="color: red;" lang="EN-US"> :New</span></b><b style=""><span style="font-family: 宋体; color: blue;">新值</span><span style="color: blue;" lang="EN-US"><span style="">  </span></span></b><b style=""><span style="font-family: 宋体; color: blue;">和</span><span style="color: blue;" lang="EN-US"><span style="">  </span></span><span style="color: red;" lang="EN-US">:Old</span></b><b style=""><span style="font-family: 宋体; color: blue;">旧值</span><span style="color: blue;" lang="EN-US"><span style="">  </span></span></b><b style=""><span style="font-family: 宋体; color: blue;">分别代表更新值，被更新的值</span></b></font></p><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">trigger</span><span style="color: rgb(0, 0, 0);"> tg_insert<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">after </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">on</span><span style="color: rgb(0, 0, 0);"> student<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> each row<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">when</span><span style="color: rgb(0, 0, 0);"> (:old.sex</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">’j’)        －－</span><span style="color: rgb(128, 128, 128);"></span><span style="color: rgb(0, 0, 0);">当old.sex为J时候才执行触发器内容<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 128);"></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">   DBMS_OUTPUT.PUT_LINE(:new.stuname</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">  </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(0, 0, 0);">:old.stuname);<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">   DBMS_OUTPUT.PUT_LINE(:new.sex</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">  </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(0, 0, 0);">:old.sex);<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);"></span></div><br /><p class="MsoNormal" style="margin-left: 21pt;"><font size="4"><b style=""><span style="font-family: 宋体; color: blue;">判断复合型触发器</span></b></font></p><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">trigger</span><span style="color: rgb(0, 0, 0);"> trgstudeng<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">before </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">delete</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">on</span><span style="color: rgb(0, 0, 0);"> student<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> each row<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">  inserting </span><span style="color: rgb(0, 0, 255);">then</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">    ...</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> deleting </span><span style="color: rgb(0, 0, 255);">then</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">    ...</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">exception<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">    ...</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">END</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);"></span></div><br /> <font color="#000080" size="4">  触发器功能强大，可以实现许多复杂的功能，但如果滥用会造成数据库及应用程序的维护困难。<br /><br /></font><font color="#000080" size="4">  (<font color="#ff0000">转载请注明出处</font>)   </font><br /><img src ="http://www.blogjava.net/improviser/aggbug/150456.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/improviser/" target="_blank">improviser</a> 2007-10-05 00:04 <a href="http://www.blogjava.net/improviser/archive/2007/10/05/150456.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle存储过程</title><link>http://www.blogjava.net/improviser/archive/2007/10/03/150224.html</link><dc:creator>improviser</dc:creator><author>improviser</author><pubDate>Tue, 02 Oct 2007 16:07:00 GMT</pubDate><guid>http://www.blogjava.net/improviser/archive/2007/10/03/150224.html</guid><wfw:comment>http://www.blogjava.net/improviser/comments/150224.html</wfw:comment><comments>http://www.blogjava.net/improviser/archive/2007/10/03/150224.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/improviser/comments/commentRss/150224.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/improviser/services/trackbacks/150224.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="text-indent: 15.8pt;">
				<font size="4">
						<b style="">
								<span style="font-family: 宋体; color: blue;">存储过程</span>
						</b>
						<span style="font-family: 宋体; color: blue;">包含三部分：</span>
						<span style="font-family: 宋体; color: maroon;">声明，执行部分，异常。</span>
				</font>
		</p>
		<p class="MsoNormal" style="text-indent: 15.8pt;">
				<font color="#000080" size="4">可以有无参数程序和带参数存储过程。</font>
		</p>
		<p class="MsoNormal" style="text-indent: 15.8pt;">
				<font color="#000080">
						<b>
								<font size="4">无参程序语法</font>
						</b>
				</font>
		</p>
		<p class="MsoNormal" style="text-indent: 15.8pt;">
		</p>
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<span style="color: rgb(0, 128, 128);">1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">procedure</span><span style="color: rgb(0, 0, 0);"> NoParPro<br /></span><span style="color: rgb(0, 128, 128);">2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);">  <img src="http://www.blogjava.net/images/dot.gif" />;<br /></span><span style="color: rgb(0, 128, 128);">3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">4</span> <span style="color: rgb(0, 0, 0);"><img src="http://www.blogjava.net/images/dot.gif" />;<br /></span><span style="color: rgb(0, 128, 128);">5</span> <span style="color: rgb(0, 0, 0);">exception<br /></span><span style="color: rgb(0, 128, 128);">6</span> <span style="color: rgb(0, 0, 0);">    <img src="http://www.blogjava.net/images/dot.gif" />;<br /></span><span style="color: rgb(0, 128, 128);">7</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">8</span> <span style="color: rgb(0, 0, 0);"></span></div>
		<font color="#000080">
				<b>
						<br />   <font size="4">带参存储过程实例</font></b>
				<font size="4">
				</font>
		</font>
		<br />
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">procedure</span><span style="color: rgb(0, 0, 0);"> queryempname(sfindno emp.empno</span><span style="color: rgb(128, 128, 128);">%</span><span style="color: rgb(0, 0, 0);">type) </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">       sName emp.ename</span><span style="color: rgb(128, 128, 128);">%</span><span style="color: rgb(0, 0, 0);">type;<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">       sjob emp.job</span><span style="color: rgb(128, 128, 128);">%</span><span style="color: rgb(0, 0, 0);">type;<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">       ....</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">exception</span><span style="color: rgb(0, 128, 128);"><br />          ....<br /></span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);"></span></div>
		<font color="#000080">
				<span style="font-family: 宋体; color: black;">
						<br />   <font size="4">带参数存储过程含赋值方式</font></span>
		</font>
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">procedure</span><span style="color: rgb(0, 0, 0);"> runbyparmeters  (isal </span><span style="color: rgb(128, 128, 128);">in</span><span style="color: rgb(0, 0, 0);"> emp.sal</span><span style="color: rgb(128, 128, 128);">%</span><span style="color: rgb(0, 0, 0);">type, <br />                            sname out </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">,sjob </span><span style="color: rgb(128, 128, 128);">in</span><span style="color: rgb(0, 0, 0);"> out </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> icount </span><span style="color: rgb(0, 0, 0); font-weight: bold;">number</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">count</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> icount </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> emp </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> sal</span><span style="color: rgb(128, 128, 128);">&gt;</span><span style="color: rgb(0, 0, 0);">isal </span><span style="color: rgb(128, 128, 128);">and</span><span style="color: rgb(0, 0, 0);"> job</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">sjob;<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> icount</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">then</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">        ....</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">        ....</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);"> exception<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">when</span><span style="color: rgb(0, 0, 0);"> too_many_rows </span><span style="color: rgb(0, 0, 255);">then</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);">      DBMS_OUTPUT.PUT_LINE(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">返回值多于1行</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">when</span><span style="color: rgb(0, 0, 0);"> others </span><span style="color: rgb(0, 0, 255);">then</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);">      DBMS_OUTPUT.PUT_LINE(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">在RUNBYPARMETERS过程中出错！</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">end</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 0, 0);"></span></div>
		<br />  <font color="#800080" size="4"><b>过程调用</b></font><font size="4"><br />  </font><font color="#800080" size="4">方式一</font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">declare</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">       realsal emp.sal</span><span style="color: rgb(128, 128, 128);">%</span><span style="color: rgb(0, 0, 0);">type;<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">       realname </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">40</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">       realjob </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">40</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">       realsal:</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(128, 0, 0); font-weight: bold;">1100</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">       realname:</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(255, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">       realjob:</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">CLERK</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">       runbyparmeters(realsal,realname,realjob);     －－</span><span style="color: rgb(0, 0, 0);">必须按顺序<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">       DBMS_OUTPUT.PUT_LINE(REALNAME</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">   </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(0, 0, 0);">REALJOB);<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">END</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"></span></div><br /> <font color="#800080" size="4"> 方式二</font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">declare</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">      realsal emp.sal</span><span style="color: rgb(128, 128, 128);">%</span><span style="color: rgb(0, 0, 0);">type;<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">      realname </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">40</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">      realjob </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">40</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">begin</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">      realsal:</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(128, 0, 0); font-weight: bold;">1100</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">      realname:</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(255, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">      realjob:</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">CLERK</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">      runbyparmeters(sname</span><span style="color: rgb(128, 128, 128);">=&gt;</span><span style="color: rgb(0, 0, 0);">realname,isal</span><span style="color: rgb(128, 128, 128);">=&gt;</span><span style="color: rgb(0, 0, 0);">realsal,sjob</span><span style="color: rgb(128, 128, 128);">=&gt;</span><span style="color: rgb(0, 0, 0);">realjob);  －－</span><span style="color: rgb(128, 128, 128);"></span><span style="color: rgb(0, 0, 0);">指定值对应变量顺序可变<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">      DBMS_OUTPUT.PUT_LINE(REALNAME</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">   </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(128, 128, 128);">||</span><span style="color: rgb(0, 0, 0);">REALJOB);<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">END</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"></span></div><p></p><font color="#000080" size="4"> </font><br /><img src ="http://www.blogjava.net/improviser/aggbug/150224.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/improviser/" target="_blank">improviser</a> 2007-10-03 00:07 <a href="http://www.blogjava.net/improviser/archive/2007/10/03/150224.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle中的OOP</title><link>http://www.blogjava.net/improviser/archive/2007/10/02/150166.html</link><dc:creator>improviser</dc:creator><author>improviser</author><pubDate>Tue, 02 Oct 2007 03:44:00 GMT</pubDate><guid>http://www.blogjava.net/improviser/archive/2007/10/02/150166.html</guid><wfw:comment>http://www.blogjava.net/improviser/comments/150166.html</wfw:comment><comments>http://www.blogjava.net/improviser/archive/2007/10/02/150166.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/improviser/comments/commentRss/150166.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/improviser/services/trackbacks/150166.html</trackback:ping><description><![CDATA[
		<div align="left">
				<span class="bright-message-list">    <font color="#000080" size="4">关系数据库在不断地发展时，许多数据库引入了面向对象的思想，这其中以Oracle为代表，Oracle9i就号称面向对象数据库。</font></span>
				<font color="#000080" size="4">
						<span class="bright-message-list">自Oracle9i以来，Oracle就不再是单纯的关系数据库管理系统，它在关系数据库模型的基础上，添加了一系列面向对象的特性。Oracle的对象体系遵从面向对象思想的基本特征，许多概念同C++,JAVA中类似，具有继承，重载，多态等特征，但又有自己的特点。<br /><br />1、</span>
				</font>
				<span class="bright-message-list">
						<font color="#000080" size="4">Oracle面向对象的最基本元素是它的对象类型——<b>Type</b>。<br />下面开始写自定义对象类型(</font>
						<font color="#000080" size="4">as object</font>
						<font color="#000080" size="4"> 必须关键字)</font>
						<br />
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 128, 128);">1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> type ADDRESS </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> object<br /></span><span style="color: rgb(0, 128, 128);">2</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);">3</span> <span style="color: rgb(0, 0, 0);">     PROVINCE </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">4</span> <span style="color: rgb(0, 0, 0);">     CITY </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">5</span> <span style="color: rgb(0, 0, 0);">     STREET </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">30</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);">6</span> <span style="color: rgb(0, 0, 0);">);</span></div>
						<br />
						<font color="#000080" size="4">创建表并使用以上对象类型ADDRESS</font>
						<br />
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 128, 128);">1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> STUDENTOBJ <br /></span><span style="color: rgb(0, 128, 128);">2</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);">3</span> <span style="color: rgb(0, 0, 0);">    STUNAME </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">4</span> <span style="color: rgb(0, 0, 0);">    STUADD  ADDRESS<br /></span><span style="color: rgb(0, 128, 128);">5</span> <span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">6</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">7</span> <span style="color: rgb(0, 0, 0);">向表中插入数据：<br /></span><span style="color: rgb(0, 128, 128);">8</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> STUDENTOBJ </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">improviser</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,ADDRESS(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">广东省</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">广州市</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">，</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">江海大道</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);</span></div>
						<br />
						<font color="#000080" size="4">通过别名对表进行查询</font>
						<br />
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 128, 128);">1</span> <span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> S.STUNAME S.ADDRESS.PROVINCE S.ADDRESS.CITY <br />2 S.ADDRESS.STREET </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> STUDENTOBJ S;</span></div>
						<font color="#000080" size="4">
								<br />
						</font>
				</span>
				<span class="bright-message-list">
						<font color="#000080" size="4">从上面的测试代码，可以很容易看到其与面向对象语言（比如Java）的差异，不必使用new创建实例，也没有了默认无参数构造器，默认使用定义的属性作为构造器参数，足以描述各种实体。另外，Type的属性没有private,protected,public的说法，所有的属性调用者都可以访问，即都是public。<br /><br />2、Oracle中面向对象特征——<b>继承</b>(父类型必须声明为NOT FINAL,子类型使用关键字UNDER)</font>
						<br />
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);">创建父类型<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> type PERSON </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> object<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    PERNAME </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    PERSEX </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">2</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(128, 128, 128);">not</span><span style="color: rgb(0, 0, 0);"> final;<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">子类型继承父类型<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> type STUDENT under PERSON<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">    STUNO </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">8</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">    STUSCORE </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">);<br /><br />由以上定义，其子类型中属性包含了父类型中所有属性。<br /></span></div>
						<b>
								<br />
						</b>
						<font color="#000080" size="4">
								<b>3、可变数组</b>
								<br />
						</font>
				</span>
				<font color="#000080" size="4">可变数组，是一种集合。一个可变数组是对象的一个集合，其中每个对象都具有相同的数据类型。可变数组的大小由创建时决定。在表中建立可变数组后，可变数组在主表中作为一个列对待。</font>
				<br />
				<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);">创建对象类型<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> type ADDRESS </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> object<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    PROVINCE </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    CITY </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">创建ADDRESS可变数组<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> type ADDRESS_LIST </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> varray(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">3</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 255);">of</span><span style="color: rgb(0, 0, 0);"> ADDRESS;<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">创建表并使用可变数组ADDRESS_LIST<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> STUDENT <br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">    STUNAME </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);">    STUADDS ADDRESS_LIST<br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);">向表中插入数据<br /></span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> STUDENT </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">improviser</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,ADDRESS_LIST(ADDRESS(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">广东省</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">广州市</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">江海大道</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">),<br />                                           ADDRESS(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">广东省</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">潮州市</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">潮枫路</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)));<br /></span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 0, 0);">查询(使用table函数将数据表格形式输出)<br /></span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> s.STUADDS </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> STUDENT </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> STUNAME</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">improviser</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);</span></div>
				<br />
				<font color="#000080" size="4">
						<b>4、嵌套表</b>
						<br />嵌套表是表中之表，一个嵌套表是某些行的集合，它在主表中表示为其中的一列。对主表中的每一条记录，嵌套表可以包含多个行。</font>
				<br />
				<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);">定义嵌套表方法：<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> type ADDRESS_TABLE </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">of</span><span style="color: rgb(0, 0, 0);"> ADDRESS;<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">基本对象类型、创建表、查询和插入数据都跟上面可变数组一样<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">嵌套表更新</span><span style="font-size: 10.5pt; font-family: 宋体; color: rgb(153, 51, 0);">（</span><span style="font-size: 10.5pt; font-family: &quot;Times New Roman&quot;; color: red;" lang="EN-US">table</span><span style="font-size: 10.5pt; font-family: 宋体; color: red;">转化为表再利用表别名操作列进行更新</span><span style="font-size: 10.5pt; font-family: 宋体; color: rgb(153, 51, 0);">）</span><br /><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> S.STUADDS </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> STUDENT S </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);">8</span><span style="color: rgb(0, 0, 0);">  S.STUNAME </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">improviser</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">) AD </span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"> AD.PROVINCE </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">北京</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> city </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">广州</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);"> 9</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">10</span><span style="color: rgb(0, 0, 0);">删除嵌套表记录<br /></span><span style="color: rgb(0, 128, 128);">11</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">delete</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> S.STUADDS </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> STUDENT S <br />12   </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> S.STUNAME </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">improviser</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">) AD </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> AD.city </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">潮州</span><span style="color: rgb(255, 0, 0);">市'</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">13</span><span style="color: rgb(0, 0, 0);"></span></div>
				<br />
				<p class="MsoNormal">
						<span style="font-family: 宋体; color: blue;">  <font size="4">  比较：可变数组，查询速度快，但是更新困难得整体更新，适用与数据不修改情况，如医生处方。使用嵌套表可以对表中的表内容进行修改而无需进行整体更新操作。</font></span>
				</p>
				<p class="MsoNormal">
						<b>
								<font color="#000080" size="4">4、对象表</font>
						</b>
				</p>
				<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);">首先创建对象类型<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">or</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 255);">replace</span><span style="color: rgb(0, 0, 0);"> type OFFICETYPE </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> object<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    id </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    typename </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">将对象类型转化为对象表<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> office </span><span style="color: rgb(0, 0, 255);">of</span><span style="color: rgb(0, 0, 0);"> officetype;<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">创建对象关系表（使用ref ，指示OID进行对象表关联）<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> worker<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">    workerid </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 255);">primary</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">key</span><span style="color: rgb(0, 0, 0);">,<br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);">    workername </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);">    workeroffice ref officetpey scope </span><span style="color: rgb(0, 0, 255);">is</span><span style="color: rgb(0, 0, 0);"> office,<br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);">    phone </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 0, 0);">使用deref 取得关联对象表相关内容<br /></span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> workerid,workername,deref(w.workeroffice),phone </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> worker w <br />   </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> workerid </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">C001</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);">结果为<br /></span><span style="color: rgb(0, 128, 128);">23</span> <span style="color: rgb(0, 0, 0);">C001   张小明  OFFICETYPE(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">0001</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">财务科</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)      </span><span style="color: rgb(128, 0, 0); font-weight: bold;">010</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(128, 0, 0); font-weight: bold;">12345</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">24</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">25</span> <span style="color: rgb(0, 0, 0);">使用VALUE(别名)查询对象内容<br /></span><span style="color: rgb(0, 128, 128);">26</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> value(o) </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> office o;<br /></span><span style="color: rgb(0, 128, 128);">27</span> <span style="color: rgb(0, 0, 0);"></span></div>
		</div>
		<br />
		<b>
				<font color="#000080" size="4">5、对象视图</font>
		</b>
		<br />
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 128, 128);">1</span> <span style="color: rgb(0, 0, 0);">创建对象视图（通过OID连接dept）<br /></span><span style="color: rgb(0, 128, 128);">2</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">view</span><span style="color: rgb(0, 0, 0);"> deptview </span><span style="color: rgb(0, 0, 255);">of</span><span style="color: rgb(0, 0, 0);"> deptype </span><span style="color: rgb(0, 0, 255);">with</span><span style="color: rgb(0, 0, 0);"> object oid(deptno) </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">*</span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> dept；<br /></span><span style="color: rgb(0, 128, 128);">3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">view</span><span style="color: rgb(0, 0, 0);"> emp_view </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> make_ref(deptview,deptno) deptoid,empno,ename <br /></span><span style="color: rgb(0, 128, 128);">4</span> <span style="color: rgb(0, 0, 255);">  from</span><span style="color: rgb(0, 0, 0);"> emp;<br /></span><span style="color: rgb(0, 128, 128);"></span><span style="color: rgb(0, 0, 0);"></span></div>
		<br />
		<font color="#000080" size="4">好了，有关Oracle中面向对象的内容就简要叙述这么多了，虽然现在很少使用到，但在以后有用到之处有一定的参考作用。</font>
		<br />
		<br />
		<font color="#000080" size="4">  (<font color="#ff0000">转载请注明出处</font>)   </font>
		<br />
<img src ="http://www.blogjava.net/improviser/aggbug/150166.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/improviser/" target="_blank">improviser</a> 2007-10-02 11:44 <a href="http://www.blogjava.net/improviser/archive/2007/10/02/150166.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle数据库对象</title><link>http://www.blogjava.net/improviser/archive/2007/10/01/150124.html</link><dc:creator>improviser</dc:creator><author>improviser</author><pubDate>Mon, 01 Oct 2007 15:43:00 GMT</pubDate><guid>http://www.blogjava.net/improviser/archive/2007/10/01/150124.html</guid><wfw:comment>http://www.blogjava.net/improviser/comments/150124.html</wfw:comment><comments>http://www.blogjava.net/improviser/archive/2007/10/01/150124.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/improviser/comments/commentRss/150124.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/improviser/services/trackbacks/150124.html</trackback:ping><description><![CDATA[    <font color="#000080" size="4">本文研究有关Oracle数据库对象的用法。Oracle中包含五种数据库对象，分别为别名、序列、视图、索引和簇，其中别名和序列为Oracle中特有的数据库对象。<br /><br />    别名：通过对Oracle中数据表设置别名之后，可以使用别名对数据表进行与原表名同样的各种操作。其语句关键字为<b><font color="#ff0000">synonym</font></b>，下面看其具体用法。<br />    创建同义词：create <font color="#ff0000">synonym </font>student for stu; <br />    通过创建后，student即为stu表的别名，因此以下两语句执行结果为一样的<br />    select *from student;  ==&gt;   select *from stu;<br />    删除同义词：drop synonym student;<br /><br />    <b>序列：</b>作为Oracle的特有对象，序列用来实现Oracle的主键自增，这是区别于其他关系数据库的。关键字为<font color="#ff0000"><b>sequence</b></font>。<br />    创建序列方法：create <b>sequence </b>NumSeq increment <b>by</b> 1 <b>start with</b> 1 <b>maxvalue </b>999;创建一个序列从1开始递增量为1并设置最大值为999。<br />    序列使用：insert into testTable values(NumSeq.nextVal);<span style="color: blue;" lang="EN-US"><br />        nextVal</span><span lang="EN-US"><span style="">  </span></span><span style="font-family: 宋体;">返回下一个可用的值</span><span style="color: blue;" lang="EN-US">;  <br />        currVal</span><span lang="EN-US"><span style="">  </span></span><span style="font-family: 宋体;">获得当前序列中值</span><span lang="EN-US"><span style="">   </span></span><span style="font-family: 宋体;">第一次需先返回一个</span><span lang="EN-US">nextVal</span><span style="font-family: 宋体;">，才能取得<b>curr</b></span><span lang="EN-US">Val</span><span style="font-family: 宋体;">值.   <br /></span><span lang="EN-US">        Alter  sequence<span style="">  </span></span><span style="font-family: 宋体;">修改序列定义: alter sequence NumSeq set maxvalue 1000;<br /><br />    <b>视图与索引：</b>其用法与其他数据库相同，这里不多赘述。<br /><br />    <b>簇：</b></span><span style="font-family: 宋体;">两表或多个表中存在相同列，将相同列存储在一个空间中，以节省空间</span>。<br />    创建簇方法：<br />    create cluser classcluser<br />    (<br />           ClassNo varchar2(10)<br />    );<br />    为簇创建索引  create index cluserIndex on cluser classcluser;<br /><br />    创建表StuClass并指向已定义簇<br />    create table StuClass <br />    (<br />           ClassNo varchar2(10)，<br />           ClassName varchar2(20)<br />    )cluser classcluser(ClassNo);<br /><br />    创建表Student并指向已定义簇<br />    create table Student<br />    (<br />           StuNo int,<br />           ClassNo varchar2(10)<br />    )cluser classcluser(ClassNo);<br /></font><br /><span style="font-family: 宋体;"></span><img src ="http://www.blogjava.net/improviser/aggbug/150124.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/improviser/" target="_blank">improviser</a> 2007-10-01 23:43 <a href="http://www.blogjava.net/improviser/archive/2007/10/01/150124.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle表分区总结</title><link>http://www.blogjava.net/improviser/archive/2007/10/01/150073.html</link><dc:creator>improviser</dc:creator><author>improviser</author><pubDate>Mon, 01 Oct 2007 10:00:00 GMT</pubDate><guid>http://www.blogjava.net/improviser/archive/2007/10/01/150073.html</guid><wfw:comment>http://www.blogjava.net/improviser/comments/150073.html</wfw:comment><comments>http://www.blogjava.net/improviser/archive/2007/10/01/150073.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/improviser/comments/commentRss/150073.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/improviser/services/trackbacks/150073.html</trackback:ping><description><![CDATA[
		<font color="#800080" size="4">    今天国庆节，愿大家玩得开心，好好放松！<br />    我也想好好放松，到各地旅游，到世界每个地方...<br />    但...<br />    ...继续努力！！！</font>
		<br />
		<br />    <font color="#000080"><font size="4">不多说题外话了，进入今天主题，如题，今天对Oracle中表分区机制作个总结。<br /><br />   Oracle中提供了对表进行分区的机制，通过表分区，可以将表空间中数据按照某种方式分别存放到特定的分区中。</font></font><font size="4"><span style="font-family: 宋体;"><font color="#0000ff">表分区的作用：</font><span style="color: red;">平衡</span></span><span style="color: red;" lang="EN-US">IO</span><span style="font-family: 宋体; color: red;">操作，分区均匀，提高效率。<br /><br />   <font color="#330000"><font color="#0000ff">Oracle中表分区方法有：范围分区法、散列分区法、复合分区法、列表分区法。<br /><br /></font> <font color="#000080"><b>范围分区</b>:</font></font></span><span style="font-family: 宋体;"><font color="#000080">语法</font></span></font><font color="#000080" size="4"><span style="color: red;" lang="EN-US"> Partition<span style="">  </span>by<span style="">  </span>range</span><span style="font-family: 宋体;">(); </span><span lang="EN-US"><span style=""></span></span></font><font color="#000080" size="4"><span style="font-family: 宋体;">适合数值型或日期型</span></font><font size="4"><br />  </font><font color="#000080" size="4">示例：</font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> Student<br /></span><span style="color: rgb(0, 128, 128);"> 2</span><span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">    Studentid </span><span style="color: rgb(0, 0, 0); font-weight: bold;">integer</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 128, 128);">not</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">,<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    Studentname </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar2</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    Score </span><span style="color: rgb(0, 0, 0); font-weight: bold;">integer</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">Partition </span><span style="color: rgb(0, 0, 255);">by</span><span style="color: rgb(0, 0, 0);"> range(Score)<br /></span><span style="color: rgb(0, 128, 128);"> 8</span><span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">    Partition p1 </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> less than(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">60</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">    Partition p2 </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> less than(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">75</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">    Partition p3 </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> less than(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">85</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">    Partition p4 </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> less than(maxvalue)<br /></span><span style="color: rgb(0, 128, 128);">13</span> )<span style="color: rgb(0, 0, 0);">;</span></div><br /><br /><font color="#000080" size="4"><b>  散列分区法：</b></font><font color="#0000ff" size="4">根据Oracle内部散列算法存储，语法 Partition by hash();</font><font size="4"><br />  </font><font color="#000080" size="4">实例：</font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> department<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">    Deptno </span><span style="color: rgb(0, 0, 0); font-weight: bold;">int</span><span style="color: rgb(0, 0, 0);">,<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    Deptname </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar2</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">24</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">Partition </span><span style="color: rgb(0, 0, 255);">by</span><span style="color: rgb(0, 0, 0);"> hash(deptno)<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">    Partition p1,<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">    Partition p2<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">);</span></div><br /><br /><font size="4"><b><font color="#000080">  复合分区法：</font></b><font color="#0000ff">由上面两种方法复合而成</font><br /><font color="#000080">  示例：</font></font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> salgrade<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">    grade </span><span style="color: rgb(0, 0, 0); font-weight: bold;">number</span><span style="color: rgb(0, 0, 0);">,<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    losal </span><span style="color: rgb(0, 0, 0); font-weight: bold;">number</span><span style="color: rgb(0, 0, 0);">,<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    hisal </span><span style="color: rgb(0, 0, 0); font-weight: bold;">number</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">Partition </span><span style="color: rgb(0, 0, 255);">by</span><span style="color: rgb(0, 0, 0);"> range(grade)<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">Subpartition </span><span style="color: rgb(0, 0, 255);">by</span><span style="color: rgb(0, 0, 0);"> hash(losal,hisal)<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">    Partition p1 </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> less than(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">10</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">      (subpartition sp1,subpartition sp2),<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">    Partition p2 </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> less than(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">      (subpartition sp3,subpartition sp4)<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">)</span></div><font size="4"><br /><br /></font><font color="#000080" size="4">  </font><font color="#000080" size="4"><b>列表分区法：</b></font><font color="#0000ff" size="4">适合字符型 语法<font size="4"></font></font><font color="#000080" size="4"><span style="color: rgb(0, 0, 0);">Partition </span><span style="color: rgb(0, 0, 255);">by</span><span style="color: rgb(0, 0, 0);"> list()</span></font><font size="4"><br />  <font color="#0000ff">实例：</font></font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">create</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">table</span><span style="color: rgb(0, 0, 0);"> customer<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">    custNo </span><span style="color: rgb(0, 0, 0); font-weight: bold;">int</span><span style="color: rgb(0, 0, 0);">,<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">    custname </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">    custState </span><span style="color: rgb(0, 0, 0); font-weight: bold;">varchar</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0); font-weight: bold;">20</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">Partition </span><span style="color: rgb(0, 0, 255);">by</span><span style="color: rgb(0, 0, 0);"> list(custState)<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">(<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">    Partition saia </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">中国</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">韩国</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">日本</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">    Partition Europe </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">英国</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">俄国</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">法国</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">    Partition ameria </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">美国</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">加拿大</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(255, 0, 0);">墨西哥</span><span style="color: rgb(255, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">),<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">    </span></div><br /><br /><font color="#000080" size="4"><b>表分区维护：<br /><br /></b></font><font color="#0000ff" size="4">添加分区:alter table student add partition p5 values less than(120);<br />删除分区:alter table student drop partition p4;<br />截断分区:alter table student truncate partition p5;<br />合并分区:alter table student merge partitions p3,p4 into partition p6;<br /><br /></font><font color="#000080" size="4">  (转载请注明出处)   </font><br /><span style="color: red;" lang="EN-US"><o:p></o:p></span><img src ="http://www.blogjava.net/improviser/aggbug/150073.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/improviser/" target="_blank">improviser</a> 2007-10-01 18:00 <a href="http://www.blogjava.net/improviser/archive/2007/10/01/150073.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>