CREATE OR REPLACE TRIGGER etl_mon.t_lotmsg_ih_tr
BEFORE INSERT
ON etl_mon.t_etl_err_lotmsg
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
l_mailhost VARCHAR2(64) := 'mailserver.silterra.com';
-- OR server iP '255.255.255.255' ;
l_from VARCHAR2(64) := 'From@silterra.com';
l_subject VARCHAR2(64) := 'Alert: Lot Message 2 hours checking!';
l_to VARCHAR2(128) := 'to@silterra.com';
l_mail_conn UTL_TCP.connection;
rc INTEGER;
BEGIN
l_mail_conn := UTL_TCP.open_connection(l_
-- open the SMTP port 25 on remote machine
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
rc := tl_tcp.write_line(l_mail_c
rc := UTL_TCP.write_line(l_mail_
rc := UTL_TCP.write_line(l_mail_
UTL_TCP.close_connection(l
END;
Main Topics
Browse All Topics





by: tomcatkevPosted on 2009-08-17 at 00:49:46ID: 25112218
Not sure I understand yet the intended result.
The trigger is on table named ETL_MON.T_LOTMSG_IH_TR. Inside this trigger, I don't find any reference to any columns of the table, it appears that the email is generated entirely context insensitive from constant data in the trigger, regardless of what data is in the record being inserted.
The SQL that you want to fire the trigger does not reference the table ETL_MON.T_LOTMSG_IH_TR either. It just seems really odd to put a trigger on a table, and then not use the content pertaining to the table in the trigger, so that the email this generates better describes the transaction.
But anyway, you can imbed SQL into a trigger, and phrase it like
DECLARE V_RETURN_RESULT;
...
select return_result INTO V_RETURN_RESULT from ETL_ERR_EXT_LOTS_DIM
where ....