oracle ±Ê¼Ç V Ö®´¥·¢Æ÷ (TRIGGER)
´¥·¢Æ÷ trigger
·ÖÀࣺǰ´¥·¢£¬ºó´¥·¢
Ðд¥·¢Æ÷£¬Óï¾ä´¥·¢Æ÷
Ðд¥·¢Æ÷ÓëÓï¾ä´¥·¢Æ÷µÄÇø±ð£º
Ðд¥·¢Æ÷ÒªÇóµ±Ò»¸ö DML Óï¾ä²Ù×÷Ó°ÏìÊý¾Ý¿âÖеĶàÐÐÊý¾Ýʱ£¬¶ÔÓÚÆäÖеÄÿ¸öÊý¾ÝÐУ¬Ö»ÒªËüÃÇ·ûºÏ´¥·¢Ô¼ÊøÌõ¼þ£¬¾ù¼¤»îÒ»´Î´¥·¢Æ÷,FOR EACH ROW Ñ¡Ïî˵Ã÷´¥·¢Æ÷ΪÐд¥·¢Æ÷£»
Óï¾ä´¥·¢Æ÷½«Õû¸öÓï¾ä²Ù×÷ ×÷Ϊ´¥·¢Ê¼þ£¬µ±ËüÃÇ·ûºÏÔ¼ÊøÌõ¼þʱ£¬¼¤»îÒ»´Î´¥·¢Æ÷
´´½¨Óï·¨:
create or replace trigger trigger_name
before |after
insert |delete | update |{[of column[,column ...]]
on [schema.]table_name
for each row
[when condition]
trigger_body;
eg(×ÐϸÌå»á):
create or replace trigger hello_tri
before insert or delete or update on emp
for each row
begin
dbms_output.put_line('ÎÒÊÇ´¥·¢Æ÷£¡');
end;
Ïà¹ØÎĵµ£º
Union£¬¶ÔÁ½¸ö½á¹û¼¯½øÐв¢¼¯²Ù×÷£¬²»°üÀ¨Öظ´ÐУ¬Í¬Ê±½øÐÐĬÈϹæÔòµÄÅÅÐò£»
Union All£¬¶ÔÁ½¸ö½á¹û¼¯½øÐв¢¼¯²Ù×÷£¬°üÀ¨Öظ´ÐУ¬²»½øÐÐÅÅÐò£»
Intersect£¬¶ÔÁ½¸ö½á¹û¼¯½øÐн»¼¯²Ù×÷£¬²»°üÀ¨Öظ´ÐУ¬Í¬Ê±½øÐÐĬÈϹæÔòµÄÅÅÐò£»
Minus£¬¶ÔÁ½¸ö½á¹û¼¯½øÐвî²Ù×÷£¬²»°üÀ¨Öظ´ÐУ¬Í¬Ê±½øÐÐĬÈϹæÔòµÄÅÅÐò¡£
¿ÉÒÔÔÚ×î ......
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii(’A’) A,ascii(’a’) a,ascii(’0’) zero,ascii(’ ’) space from dual;
A A ZERO SPACE
--------- --------- --------- ---------
65 97 48 32
2.CHR
¸ø³öÕ ......
´Ó10g¿ªÊ¼£¬oracle¿ªÊ¼ÌṩShrinkµÄÃüÁ¼ÙÈçÎÒÃǵıí¿Õ¼äÖÐÖ§³Ö×Ô¶¯¶Î¿Õ¼ä¹ÜÀí (ASSM),¾Í¿ÉÒÔʹÓÃÕâ¸öÌØÐÔËõС¶Î£¬¼´½µµÍHWM¡£ÕâÀïÐèҪǿµ÷Ò»µã£¬10gµÄÕâ¸öÐÂÌØÐÔ£¬½ö¶ÔASSM±í¿Õ¼äÓÐЧ£¬·ñÔò»á±¨ ORA-10635: Invalid segment or tablespace type¡£
Èç¹û¾³£ÔÚ±íÉÏÖ´ÐÐDML²Ù× ......
ÔÚwindowsÏÂsqlplusÍêÈ«Õý³££¬¿ÉÊǵ½linuxÏ£¬sqlplusÖÐÎÄÏÔʾ¾Í³öÎÊÌâÁË£¬×ÜÊÇÏÔʾ“??”£¬Õâ¸öÎÊÌâÓÖÔõô½â¾öÄØ£¿
¾¹ýÔÚÍøÂçÉϲé×ÊÁÏ£¬ÒÔ¼°³¢ÊÔ£¬µÃµ½µÄ½â·¨ÈçÏ£º
ÆäʵºÜ¼òµ¥ÎÒÃÇÖ»ÒªÉèÖÃÍ˳ösqlplus,ÉèÖÃÏàÓ¦µÄ»·¾³±äÁ¿NLS_LANG
export NLS_LANG="SIMPLI ......
OracleÊý¾Ý¿âÌṩÁ˼¸ÖÖ²»Í¬µÄÊý¾Ý¿âÆô¶¯ºÍ¹Ø±Õ·½Ê½£¬±¾ÎĽ«Ïêϸ½éÉÜÕâЩÆô¶¯ºÍ¹Ø±Õ·½Ê½Ö®¼äµÄÇø±ðÒÔ¼°ËüÃǸ÷×Ô²»Í¬µÄ¹¦ÄÜ¡£
Ò»¡¢Æô¶¯ºÍ¹Ø±ÕOracleÊý¾Ý¿â
¡¡¡¡¶ÔÓÚ´ó¶àÊýOracle DBAÀ´Ëµ£¬Æô¶¯ºÍ¹Ø±ÕOracleÊý¾Ý¿â×î³£Óõķ½Ê½¾ÍÊÇÔÚÃüÁîÐз½Ê½ÏµÄServer Manager¡£´ÓOracle 8iÒÔºó£¬ÏµÍ³½«Server ManagerµÄËùÓй¦Äܶ¼¼¯Öе ......