SE Trigger/Exception problem
Posted in 1999
Here's hoping the answer to this isn't too obvious! I have an insert trigger on a table which is designed to reject the row being inserted if certain consistency rules are violated. Nothing unusual there, I hope. The mechanism used is that the trigger calls a stored procedure 'for each row', and the stored procedure raises a -746 exception if the consistency checks fail. This always seemed to work fine. Attempting to insert a row which I know should fail results in the exception being reported to DB-Access, and the table in question does not then contain the offered row. However, I've now discovered that if I try the same insert within a transaction (i.e. after a 'begin work' -- it's a non-ANSI database) then, although I still see the exception report, the offered row *does* find its way into the table. I can 'commit work' without any problem too. Clearly, I don't expect a user to be able to circumvent my business rules in this way. Therefore, I suspect that my means of implementation is incorrect in some way. But my implementation is similar to the upd_items_p2 example on page 13-15 of Informix Guide to SQL - Tutorial (April 1996 Part Number 000-7883A), where, although not explicitly stated, the intuitive implication seems to be that the operation would be inhibited. This is: Informix SE 7.24.UC5 Red Hat Linux 6.0 Many thanks for any help offered. Cliff.