每次修改数据的时候都写入到test表中2条数据 为什么 这写的有问题吗,没有分了。帮帮忙吧 create or replace trigger tr
after update or delete
on test
begin
if updating then
insert into testlog (lid,lname) values(testlog_seq.nextVal,'更新用户信息');
end if;
end;
after update or delete
on test
begin
if updating then
insert into testlog (lid,lname) values(testlog_seq.nextVal,'更新用户信息');
end if;
end;
create or replace TRIGGER IMSI2MOBILE_UserPoints_trig
AFTER INSERT OR UPDATE OR DELETE ON imsi2mobile
FOR EACH ROW
DECLARE
v_singlepoints NUMBER(18);
v_number_seq NUMBER(18);
v_rand_pwd VARCHAR2(50);
BEGIN
IF UPDATING THEN
UPDATE UserPoints SET mobile=:new.mobile WHERE mobile=:old.mobile;
ELSIF DELETING THEN
DELETE FROM UserPoints WHERE mobile=:old.mobile;
DELETE FROM UserPointsLog WHERE mobile=:old.mobile;
DELETE FROM MonetarySystemUserAccount u1
WHERE EXISTS (SELECT u2.accountID
FROM MonetarySystemUserExpendInfo u2
WHERE telephone=:old.mobile
AND u2.accountID=u1.accountID );
DELETE FROM MonetarySystemUserExpendInfo WHERE telephone=:old.mobile;
ELSIF INSERTING THEN
SELECT number_seq.nextval INTO v_number_seq FROM DUAL;
SELECT to_char(DBMS_RANDOM.value(100000,9999999999)) INTO v_rand_pwd FROM dual;
SELECT singlepoints INTO v_singlepoints FROM opera_points_map WHERE useropera='TO_REGISTER';
INSERT INTO UserPoints(mobile, usertype, points,grade, cdate) VALUES(:new.mobile,1,v_singlepoints,1,:new.cdate);
INSERT INTO UserPointsLog (Cdate, mobile, UserType, UserOpera, DayPoints)
VALUES(:new.cdate,:new.mobile,1,'TO_REGISTER',v_singlepoints);
INSERT INTO MonetarySystemUserAccount(accountid,password,amount,username)
VALUES (v_number_seq,v_rand_pwd,0,'好联络');
INSERT INTO MonetarySystemUserExpendInfo(accountid,erjipassword,telephone,gender,industry,career,education)
VALUES(v_number_seq,v_rand_pwd,:new.mobile,0,0,0,0);
END IF;
END;
/
改成如下的呢...
create or replace trigger tr
after update
on test
for each row
begin
insert into testlog (lid,lname) values(testlog_seq.nextVal,'更新用户信息');
end;
SQL> create or replace trigger tr
2 after update or delete on test
3 begin
4 if updating then
5 insert into testlog(lid,lname) values(testlog_seq.nextval,'update');
6 end if;
7 end;
8 /触发器已创建SQL>
SQL> update test set cola='2';已更新 1 行。SQL> commit;提交完成。SQL> select * from testlog; LID LNAME
---------- --------------------
1 updateSQL> update test set cola='3';已更新 1 行。SQL> commit;提交完成。SQL> select * from testlog; LID LNAME
---------- --------------------
1 update
2 updateSQL>没有看到你说的情况
---------- ------------------------------ ------------------------------
61 更新用户信息
62 更新用户信息
就这样的 改成 java3344520 说的那样 也是这样 哎…………