Re: Triggers using stored procedures
Posted in 1996
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. > Help!!!! Kumar, what you are trying to do is impossible this way. By the time the engine gets to the trigger, the data has already been truncated. However, you might perform the insert within a stored procedure. The proc should accept the data in a large (200 bytes?) char variable and it will know that the target column accepts only 20 bytes. The proc can insert the first 20 bytes into the target table, an variable[21,200] into the overflow table. (Too bad this can't be generalized. For now, SPL does not understand variable subscripts like somestring[x,y].) -- Jake Salomon (Just chock full of life preservers tonight)