RE: SEND MAIL thru TRIGGER
Posted in 1998
---------- Ramki Natesan (rnatesan@bactc.com) asked: >When a field gets updated, I need to notify bunch of people. >How can I send an E-MAIL thru trigger mechanism in Informix. >Is it possible? You can do it, I guess, though how hard it is depends on how long the message is. You'd create an update trigger on the column, and arrange to execute a stored procedure which is given the key information (presumably the primary key of the row being updated and the old and new values of the field). The stored procedure, in turn, would arrange to run a command with the SYSTEM statement; the command string would be built in the SP from the information passed into the SP and other data. If you run a shell script, you don't even have to list the users in the command line; just the data which changes. Beware of the environment which runs the program - it is likely to be different from the user's environment. >OR Can I write a STORED PROCEDURE using I4GL? HOW? If you mean 'can I write an SP using the syntax of I4GL' then the answer is No. If you mean, can I use I4GL to create a stored procedure, the answer is a qualified Yes. You can, but I wouldn't. If you want to, you create a string with the CREATE PROCEDURE statement in it, and then prepare the string and execute the prepared statement. I'd use DB-Access, SQLCMD or the MKPROC program I posted yesterday rather than bothering with I4GL. Yours, Jonathan Leffler (jleffler@visa.com) #include <bother.ms-exchange.h>