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

求一触发器
在table上建一个触发器,table中有一个字段mubiaobiao是xxx.yyyy的格式,需要根据每条插入记录的mubiaobiao字段值,写到不同的临时表,xxx是临时表的名字,yyyy是临时表中要写入的值,该怎么写?

CREATE TRIGGER TRIGGER AFTER INSERT ON table 
  FOR EACH ROW 
  BEGIN
  SET @v_char=(select targetdocid from table inserted)
  
  (这里该怎么写)

  INSERT INTO xxx VALUES(xxx,1); 
  END;

------解决方案--------------------
探讨
create table tab
(
mubiaobiao varchar2(20)
);

create table temp_tab01
(
val varchar2(10)
);

create table temp_tab02
(
val varchar2(10)
);

create or replace trigger trg_tab
after insert on tab
referencing new as new old as old
for each row
declare
v_mubiaobiao tab.mubiaobiao%type;
f_val varchar2(10);
l_val varchar2(10);
temp_sql varchar2(50);
begin …

------解决方案--------------------
探讨
SQL code
CREATE SEQUENCE tab$_SEQ START WITH 1 MINVALUE 1 MAXVALUE 2147483647

create or replace trigger trg_tab
after insert on tab
referencing new as new old as old
for each row
declare
v_mubiaobiao tab.mubiaobiao%type;
f_val varchar2(10);
l_val varchar2(10);
temp_sql varchar2(50);
begin
v_mubiaobiao:=:new.mubiaobiao;
f_val:=SUBSTR(v_mubiaobiao,1,INSTR(v_mubiaobiao,'.'…

------解决方案--------------------
我的总技术分是0,怎么提高啊???