日期:2014-05-17  浏览次数:20757 次

求简单的触发器问题
我有一张表a  
id name pwd sum uid
001 ss 123 100 1
002 ww 11 200 2
002 qq 22 100 3

b
uid uname  
1 rr  
2 tt

然后create table c as
(select a.id, a.name, a.pwd, a.sum, a.uid,b.uname from a left jion b on a.uid=b.uid )

创建好的c表结构如下
id name pwd sum uid uname

c表建好之后,想做一个触发器,当向a表中插入或者更新一条记录时,
就在c表中增加一条记录。
求个具体写法。


------解决方案--------------------
仅供参考:

SQL code

create or replace trigger AutoInsert_A 
after insert or update on a REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW

begin
    insert c 
    select new.id,new.name,new.pwd,new.sum,new.uid,b.uname
    from a left jion b on new.uid=b.uid 
end AutoInsert_A ;

------解决方案--------------------
http://topic.csdn.net/u/20081203/20/787d9749-33d4-4561-ac66-eb37488cd1e5.html