对表写一个触发器,BEFORE INSERT

解决方案 »

  1.   

    触发器、过程如何写?
    首先,A不是个VIew,所以不能写成Insteadof 触发器,
    其次,若用Before Insert触发器,B表录入了数据,但是A中仍然有2条记录。要求A中只有1条记录。
      

  2.   

    给A写触发器:before insert
    如果符合你的要求,最后就来个  :old = :old
      

  3.   

    create or replace procedure aaa
    is
    num number;
    begin
    select count(*) into num from a where col1 is null;
    if num=0 then
    insert into ....
    else
    insert into...
    end if;
    commit;
    end aaa;
      

  4.   

    没有看清题目
    create or replace procedure aaa(str in varchar2)
    is
    num number;
    begin
    select count(*) into num from a where col1=str;
    if num=0 then
    ...
    else
    ....
    end if;
    commit;
    end aaa;
    if...else中插入你要insert的操作