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;
Ïà¹ØÎĵµ£º
1. ´´½¨ÊÓͼ£º
CREATE OR REPLACE VIEW SM_V_UNIT_AUTH AS
SELECT T2.UNIT_ID,
T2.SUPER_UNIT_ID,
T1.AUTH_ID,
T1.AUTH_NAME,
T1.A ......
1¡¢ÓÃdblinkÁ´½Óoracle
£¨1£©ÓëÆ½Ì¨Î޹صÄд·¨£º
create public database
link cdt connect to apps
identified by apps using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.31.205.100)(PORT = 1541))
)
(CONNECT_DATA =
(SERVICE_NAME = CDT)
)
)'
£¨2£©¿ÉÒÔ½«µ¥ÒýºÅÄÚµÄÄÚÈÝ ......
½ñÌìÔÚnet managerÅäÖñ¾µØ·þÎñʱ³öÏÖÕâÑùµÄÎÊÌâ
ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect descriptor
ÔÚgoogleÉÏËÑË÷µÃµ½Èô¸É´ð°¸£¬×ÜÊDz»¶Ô£¬ºóÀ´ÔÚͬʵİïÖúϽâ¾öÁËÎÊÌ⣬ÏÖÔÚ×ܽáһϸú´ó¼Ò·ÖÏí¡£
1¡¢Ñ¡Öб¾µØ——·þÎñÃüÃû£¬ÔÚ±à¼Öд´½¨
2¡¢ÊäÈënet·þÎñÃû£¬×¢ÒâÕâÊÇ ......
OracleÊý¾Ý¿âÌṩÁ˼¸ÖÖ²»Í¬µÄÊý¾Ý¿âÆô¶¯ºÍ¹Ø±Õ·½Ê½£¬±¾ÎĽ«Ïêϸ½éÉÜÕâЩÆô¶¯ºÍ¹Ø±Õ·½Ê½Ö®¼äµÄÇø±ðÒÔ¼°ËüÃǸ÷×Ô²»Í¬µÄ¹¦ÄÜ¡£
Ò»¡¢Æô¶¯ºÍ¹Ø±ÕOracleÊý¾Ý¿â
¡¡¡¡¶ÔÓÚ´ó¶àÊýOracle DBAÀ´Ëµ£¬Æô¶¯ºÍ¹Ø±ÕOracleÊý¾Ý¿â×î³£Óõķ½Ê½¾ÍÊÇÔÚÃüÁîÐз½Ê½ÏµÄServer Manager¡£´ÓOracle 8iÒÔºó£¬ÏµÍ³½«Server ManagerµÄËùÓй¦Äܶ¼¼¯Öе ......
Ò» ÒýÑÔ
Êý¾Ý²Ö¿â¼¼ÊõÊÇĿǰÒÑÖªµÄ±È½Ï³ÉÊìºÍ±»¹ã·º²ÉÓõĽâ¾ö·½°¸£¬ÓÃÓÚÕûºÍµçÐÅÔËÓªÆóÒµÄÚ²¿ËùÓзÖÉ¢µÄÔʼҵÎñÊý¾Ý£¬²¢Í¨¹ý±ã½ÝÓÐЧµÄÊý¾Ý·ÃÎÊÊֶΣ¬¿ÉÒÔÖ§³ÖÆóÒµÄÚ²¿²»Í¬²¿ÃÅ£¬²»Í¬ÐèÇ󣬲»Í¬²ã´ÎµÄÓû§ËæÊ±»ñµÃ×Ô¼ºËùÐèµÄÐÅÏ¢¡£Êý¾Ý²Ö¿âϵͳÐèÒªÄܹ»¼°Ê±µØ×·×ٺͷÖÎö´óÁ¿µÄÀúÊ·Êý¾Ý£¬²¢Äܹ»¼°Ê±×ö³ö·ÖÎöºÍÔ¤²â£¬Òò´ËÊ ......