Re: Triggers using stored procedures
Posted in 1996
Topics: Stored Procedures & SPL, Data Types & Schema Design, Triggers, Constraints & Referential Integrity
Jake Salomon wrote: > > Kumar Balasubramanian wrote: > > > > 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. > > 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. Another possible solution is changing th field type to VARCHAR to allow more data to be stored at the cost of one extra byte per record. If many values are already 2 or more bytes less, you can reduce disk storage which can lead to faster access. -- wilcoxon@pioneerplanet.infi.net ********************************************************************** ... this is only a test ... if this had been a real signature it would have been interesting **********************************************************************