|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
各位大俠可否幫忙解決以下問題, 謝謝啦!!
以下程式測試ok, 但需要 添加兩個條件 1.user被修改DEPT後 希望在收到此MAIL通知 時間都在每天早上8點
2.修改 BEGIN下的內容讓其在mail中以橫向顯示如下
ID NO NAME ADRESS NEW DEPT OLD DEPT
123 王雷 江蘇 HA5100 SB1400
create or replace trigger TDD021
BEFORE DELETE OR UPDATE
ON dds15
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
declare
V_DBNAME VARCHAR2(5);
V_ddm22 ddm22%ROWTYPE;
PROCEDURE ER_SEND_MAIL IS
V_DB_NAME VARCHAR2(10);
BEGIN
select name into V_DB_NAME from v$database;
V_Ddm22.RECEIVER := 'ZHU_HUIJUAN@calcomp.com.cn';
V_DDM22.SUBJECT := '變更通知';
V_DDM22.CONTENT := 'Dear USER: '||chr(10)||chr(10)||chr(10)||
'ID NO ¦:NEW.ID_NO:'||chr(10)||
'NAME:'||:NEW.NAME||chr(10)||
'ADRESS:'||:NEW.ADRESS||chr(10)||
'DEPT:'||:NEW.DEPT||chr(10)||
'DEPT:'||:OLD.DEPT||chr(10)||
'If you have any question ,please contact with us!';
INSERT INTO DDM22 (RECEIVER,SUBJECT,CONTENT,LAST_UPD,UID1)
VALUES
(V_DDM22.RECEIVER,V_DDM22.SUBJECT,V_DDM22.CONTENT,SYSDATE,USER);
END ER_SEND_MAIL;
BEGIN
SELECT NAME INTO V_DBNAME FROM V$DATABASE;
IF updating then
IF :NEW.SOURCE_CD='R' AND :OLD.DEPT LIKE 'H%' AND :NEW.PURCHASER NOT LIKE 'S%' THEN
ER_SEND_MAIL;
END IF;
END IF;
END ; |
|