oracleÎĵµµÚ¾ÅÕ´¥·¢Æ÷(1)
µÚ¾ÅÕÂ½Ú :´¥·¢Æ÷±àÂë
´¥·¢Æ÷ÊÇ´æ´¢ÔÚÊý¾Ý¿â´æÖÐÒþʽµÄÔËÐлòÕß±»´¥·¢µÄÒ»¶Î³ÌÐò£¬µ±Ä³Ð©Ê¼þ·¢Éú¡£Í¨³£Çé¿öÏ£¬´¥·¢Æ÷ÖÐÖ§³Ö¿ÉÖ´ÐеÄÒ»¶Îpl/sql´úÂë¿é£¬µ±Ò»¸öinsert,update,»òÕßdeleteÃüÃû·¢ÉúÔÚÒ»¸ö±í»òÕßÊÓͼÉϵÄʱºò¡£ÆäÒ²Ö§³ÖϵͳºÍÊý¾Ý¿â»òÕß·½°¸Ê¼þ.oracleÊý¾Ý¿âÒ²Ö§³Ö´¥·¢Æ÷Öк¬ÓпÉÖ´ÐеÄpl/sql»òjava³ÌÐò.
¸ÃÕ½ÚÌÖÂÛdml´¥·¢Æ÷£¬instead of ´¥·¢Æ÷ºÍϵͳ´¥·¢Æ÷(Êý¾Ý¿â/·½°¸´¥·¢Æ÷),ÄÚÈÝÈçÏÂ:
Éè¼Æ´¥·¢Æ÷
´´½¨´¥·¢Æ÷
´¥·¢Æ÷ºËÐÄ´úÂë
±àÒë´¥·¢Æ÷
ÐÞ¸ÄÒÑÓеĴ¥·¢Æ÷
(enabling and disabling triggers)ʹÓúÍ[disabling]½Ç·¢Æ÷
²é¿´´¥·¢Æ÷Ïà¹ØµÄÐÅÏ¢
´¥·¢Æ÷ʵÀý´úÂë
Óô¥·¢Æ÷ÏìÓ¦[responding]ϵͳʼþ
9.1Éè¼Æ´¥·¢Æ÷
ÔÚÉè¼Æ´¥·¢Æ÷ʱ£¬Ê¹ÓÃÏÂÁÐÉè¼ÆÔÔò
´¥·¢Æ÷ÓÃÀ´±£Ö¤µ±Ò»¸öÌض¨µÄ²Ù×÷±»Ö´ÐÐʱ£¬ºÍ¸Ã²Ù×÷Ïà¹ØµÄ¶¯×÷Ò²±»Ö´ÐС£
µ±Ò»¸öÖظ´[duplicate]¹¦ÄÜÔÚÊý¾Ý¿âÖдæÔÚ£¬´ËʱҪ±ÜÃâʹÓô¥·¢Æ÷¡£ÀýÈç,Èç¹ûÄÜÓÃÊý¾ÝÍêë·ÐÔÔ¼ÊøÀ´ÊµÏÖά²»ºÏ·¨µÄÊý¾Ý´æ´¢µ½Êý¾Ý¿âʱ£¬¾ÍûÓбØҪʹÓô¥·¢Æ÷À´ÊµÏÖÏàͬµÄ¹¦ÄÜ¡£[refect]¾Ü¾ø
ÏÞÖÆ´¥·¢Æ÷³ÌÐò´úÂëµÄ´óС£¬Èç¹û´¥·¢Æ÷µÄʵÏÖÂß¼ÐèÒª³¬¹ý60ÐдúÂ룬ÄÇô×îºÃ°Ñ´óÁ¿µÄ´úÂë´æ´¢ÔÚÒ»¸ö´æ´¢¹ý³ÌÖУ¬È»ºóÔÚ´¥·¢Æ÷Öе÷Óøô洢¹ý³Ì¡£
regardless of[ÎÞÂÛ] ÎÞÂÛÊÇÓû§»òÕßÊý¾Ý¿â[issues]´¥·¢Æ÷ʼþ£¬´¥·¢Æ÷Êǽö½öÓÃÀ´[centralized]¼¯Öй«¹²µÄ²Ù×÷±»µ÷Óá£
²»Òª´´½¨[recursive]µÝ¹éÐԵĴ¥·¢Æ÷¡£È磬´´½¨Ò»¸öÔÚEmp_tab after updateÓïÃûµÄ´¥·¢Æ÷,ÔڸñíÖÐÓÖ¶¨ÒåÁËÒ»¸öupdate Óï¾ä£¬Ê¹¸Ã´¥·¢Æ÷µÝ²¹¹éµÄ±»µ÷ÓÃÖ±µ½ÄÚ´æÒç³ö¡£
ÒªÃ÷Öª[judiciously]µÄÓô¥·¢Æ÷,ËüÔÚÿ¸öÓû§,ÈκÎʱ¼ä±»Ö´ÐÐ,µ±Ê¼þ·¢ÉúÔÚÒѾ¶¨ÒåºÃµÄ´¥·¢Æ÷ÉÏ.
9.2´´½¨´¥·¢Æ÷
¿ÉÒÔʹÓÃÈκÎ[interactive]»¥Ïཻ»¥µÄ¹¤¾ß,Èçsql*plus »òenterprise manager,ÓÃCREATE TRIGGER statementÃüÁîÀ´´´½¨.ÔÚʹÓý»»¥¹¤¾ß±àдÍê´¥·¢Æ÷ʱ,ÔÚ³ÌÐòĩβ¼ÓÉÏ('/')×Ö·ûÊÇ[necessary]±ØÒªµÄ£¬À´Ê¹¸Õ´´½¨µÄ´¥·¢Æ÷¼¤»î[activate]¡£
ÈçÏÂÃüÁîÔÚemp_tab±íÉÏ´´½¨Ò»¸ö´¥·¢Æ÷:
CREATE OR REPLACE TRIGGER Print_salary_changes
Ïà¹ØÎĵµ£º
DML Error Logging in Oracle 10g
Ö÷ÒªÔÚÓÚʹÓÃDBMS_ERRLOG.create_error_log Õâ¸ö°üÀ´¸ú×Ùdml´íÎóÐÅÏ¢
SQL> CREATE TABLE source (
2 id NUMBER(10) NOT NULL,
3 code VARCHAR2(10),
4 description VARCHAR2(50),
5 CONSTRAINT source_pk PRIMARY KEY (id)
6 );
±íÒÑ´´½¨¡£
SQL> DECLARE
2 TYPE t_tab IS ......
×÷Õߣº ÈÕÆÚ£º2005-12-8 1:43:32 À´Ô´£ºInternet µã»÷£º´Î ÆÀÂÛ
¡¡¡¡±¾ÎÄÖ»ÌÖÂÛOracleÖÐ×î³£¼ûµÄË÷Òý£¬¼´ÊÇB-treeË÷Òý¡£±¾ÎÄÖÐÉæ¼°µÄÊý¾Ý¿â°æ±¾ÊÇOracle8i¡£
¡¡¡¡Ò». ²é¿´ÏµÍ³±íÖеÄÓû§Ë÷Òý
¡¡¡¡ÔÚOracleÖУ¬SYSTEM±íÊÇ°²×°Êý¾Ý¿âʱ×Ô¶¯½¨Á¢µÄ£¬Ëü°üº¬Êý¾Ý¿âµÄÈ«²¿Êý¾ ......
ÔÎļûhttp://blog.csdn.net/kele1121/archive/2009/10/30/4742051.aspxÓëhttp://www.itpub.net/thread-1105403-1-1.html
Ëùν
Oracle
µÄÌåϵ¼Ü¹¹£¬ÊÇÖ¸
Oracle
Êý¾Ý¿â¹ÜÀíϵͳµÄµÄ×é³É²¿·ÖºÍÕâЩ×é³É²¿·ÖÖ®¼äµÄÏ໥¹Øϵ£¬°üÀ¨
ÄÚ´æ½á¹¹¡¢ºǫ́½ø³Ì¡¢ÎïÀíÓëÂß¼½á¹¹µÈ¡£
Oracle
Êý¾Ý¿âµÄÌåϵºÜ¸´ÔÓ£¬¸´Ô ......
OracleµÄÍâ¼üÓÃÀ´ÏÞÖÆ×Ó±íÖвο¼µÄ×ֶεÄÖµ£¬±ØÐëÔÚÖ÷±íÖдæÔÚ¡£¶øÇÒÔÚÖ÷±íµÄ¼Ç¼·¢Éú±ä»¯µ¼ÖÂÍâ¼ü²Î¿¼Î¨Ò»Ô¼ÊøÖµ·¢ÉúÁ˱仯ʱ£¬¶¨ÒåÁËһϵÁеĶ¯×÷¡£
ÔÚSQL92±ê×¼Öж¨ÒåÁ˼¸ÖÖÍâ¼ü¸Ä±äºó£¬ÈçºÎ´¦Àí×Ó±í¼Ç¼µÄ¶¯×÷£¬ÆäÖаüÀ¨£º
ÏÞÖÆRestrict£ºÕâÖÖ·½Ê½²»ÔÊÐí¶Ô±»²Î¿¼µÄ¼Ç¼µÄ¼üÖµÖ´Ðиüлòɾ³ýµÄ²Ù×÷£»
ÖÃΪ¿ÕSet to nu ......