Re: Triggers using stored procedures
Posted in 1996
Topics: Stored Procedures & SPL, Security, Permissions & Auditing, Triggers, Constraints & Referential Integrity
Kumar Balasubramanian wrote: > > Hi, > I have a table T with a column C of type char(20). > The problem is whenever someone inserts a string S of >20 chars > into C, Informix truncates S and stores only the first 20 chars. > I am supposed to write a trigger which will take the remaining > portion of S and store it in a overflow table. > I am unable to get the value of S in the trigger. All I get is > the pre and post images (old and new) of C truncated to the > first 20 chars. This is not a job for triggers. The only thing to do is write a stored procedure that accepts the new record, checks for the overflow and does the truncation before actually inserting the new record. The only issue here is that any insert must use the new SP. You can revoke INSERT on the table and grant privileges on the SP. But if you have an existing application, the INSERTs must be changed to procedure calls. :-) Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | The Informix FAQ is at http://www.iiug.org | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+