<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>~SingleForum~无废话记录~ Topic: 触发器的设置</title>
<link>http://www.ll19.com/bb/</link>
<description>~19~记录点有用的好吗？少说废话少装b~</description>
<language>en</language>
<pubDate>Tue, 07 Feb 2012 08:49:21 +0000</pubDate>

<item>
<title>admin on "触发器的设置"</title>
<link>http://www.ll19.com/bb/topic/39#post-39</link>
<pubDate>Mon, 16 Mar 2009 08:52:06 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">39@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;1.首先在ORACLE服务器的NET中建立一个需要触发数据库的连接 比如叫@LINK_200&#60;br /&#62;
2.打开PLSQL 在DATABASE LINE中右键选择新建 用户名口令是需要触发数据库的用户名和口令 数据库是配置的NET连接最后起的名字 名称随意&#60;br /&#62;
3.写需要触发的语句 例如&#60;br /&#62;
<div class="igBar"><span id="lsql-1"><a href="#" onclick="javascript:showPlainTxt('sql-1'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">SQL:</span><br /><div id="sql-1">
<div class="sql"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> <span style="color: #993333; font-weight: bold;">TRIGGER</span> TRI_GROUP_PROP&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">AFTER <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">ON</span> EISS_TAB_GROUP_PROP&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">REFERENCING NEW <span style="color: #993333; font-weight: bold;">AS</span> NEW OLD <span style="color: #993333; font-weight: bold;">AS</span> OLD&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">FOR</span> EACH ROW&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BEGIN&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">IF</span> INSERTING THEN&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> &amp;<span style="color: #808080; font-style: italic;">#60;a href=&amp;#34;mailto:EISS_TAB_GROUP_PROP@LINK_200&amp;#34;&amp;#62;EISS_TAB_GROUP_PROP@LINK_200&amp;#60;/a&amp;#62;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span>U_GROUPID,&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;PROPID,&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;PROPVALUE<span style="color:#006600; font-weight:bold;">&#41;</span>&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; VALUES&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span>:NEW.U_GROUPID,&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;:NEW.PROPID,&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;:NEW.PROPVALUE<span style="color:#006600; font-weight:bold;">&#41;</span>;&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; ELSIF UPDATING THEN&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">UPDATE</span> &amp;<span style="color: #808080; font-style: italic;">#60;a href=&amp;#34;mailto:EISS_TAB_GROUP_PROP@LINK_200&amp;#34;&amp;#62;EISS_TAB_GROUP_PROP@LINK_200&amp;#60;/a&amp;#62;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SET</span> PROPID&nbsp; &nbsp; = :NEW.PROPID,&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PROPVALUE = :NEW.PROPVALUE&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">WHERE</span> U_GROUPID = :OLD.U_GROUPID;&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; ELSIF DELETING THEN&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> &amp;<span style="color: #808080; font-style: italic;">#60;a href=&amp;#34;mailto:EISS_TAB_GROUP_PROP@LINK_200&amp;#34;&amp;#62;EISS_TAB_GROUP_PROP@LINK_200&amp;#60;/a&amp;#62; WHERE U_GROUPID = :OLD.U_GROUPID;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; END <span style="color: #993333; font-weight: bold;">IF</span>;&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">END;&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62; </span></div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;则 打开PLSQL 在TRIGGERS中就会有TRI_GROUP_PROP的触发器&#60;/p&#62;
&#60;p&#62;SQL中@LINK_200指的是触发@LINK_200这个数据库&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="lsql-2"><a href="#" onclick="javascript:showPlainTxt('sql-2'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">SQL:</span><br /><div id="sql-2">
<div class="sql"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">AFTER <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">ON</span> EISS_TAB_GROUP_PROP&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62; </span></div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;指的是在执行INSERT OR UPDATE OR DELETE ON EISS_TAB_GROUP_PROP后执行相应的语句
&#60;/p&#62;</description>
</item>

</channel>
</rss>

