-- File created from mail_triggers.sql - Dave Banks - FALCP/CA/1771 - 8th March 2006

create or replace trigger ti_mail_global
before insert on mail_global
for each row
begin

	/*
	 * For each row inserted :
	 *  - Generate the next sequential global_msg_id
	 *  - Set the msg_time to today's date.
	 */

	select
		gmsgid_gen.nextval
	into
		:new.global_msg_id
	from
		dual;
	
	:new.msg_time := SYSDATE;
	
	dbms_alert.signal( :new.msg_address, 'before insert' );

end;
/
