CREATE OR REPLACE TRIGGER APPS.xx_send_mail_trigger
AFTER insert
ON dept
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
6 DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
tmpVar NUMBER;
v_sqlerrm varchar2(500);
var1 varchar2(250);
var2 varchar2(250);
BEGIN
tmpVar := 0;
v_sqlerrm :=NULL;
UTL_MAIL.send(sender => 'xyz@gmail.com',
recipients => 'xyz@gmail.com',
cc => 'xyz@gmail.com',
bcc => 'xyz@gmail.com',
subject => 'UTL_MAIL Test',
message => 'If you get this message it worked!');
COMMIT;
END xx_send_mail_trigger;
/
Trigger created.
CREATE or REPLACE TRIGGER TR_TEST
AFTER INSERT ON dept_test
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
tmpVar NUMBER;
a NUMBER;
v_sqlerrm varchar2(500);
var1 varchar2(250);
var2 varchar2(250);
BEGIN
tmpVar := 0;
v_sqlerrm :=NULL;
SELECT deptno INTO a FROM dept_test WHERE deptno=:NEW.deptno;
DBMS_OUTPUT.PUT_LINE('This is to inform that following deliveries has been shipped in Oracle' || ',' || a);
UTL_MAIL.send(sender => 'xyz@gmail.com',
recipients => 'xyz@gmail.com',
cc => 'xyz@gmail.com',
bcc => 'xyz@gmail.com',
subject => 'This is to inform that following deliveries has been shipped in Oracle',
message => 'This is to inform that following deliveries has been shipped in Oracle');
COMMIT;
END TR_TEST;
/
Trigger created.
No comments:
Post a Comment