Triggers in Informix
Posted in 1995
Steve Huff writes: Two questions from a novice Informix programmer: 1. Does Informix support the definition of database "triggers" to allow some defined activity (e.g. "update") on a column or row to automatically fire off some pre-defined code? If so, where can I find information about how to do this? I need to recalculate the value in one table every time one of the contributing values in another tables gets updated. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Available in V5 onwards. You should have a separate triggers manual that defines how you use them. 2. Is there anyway that I can cause a SELECT statement to return every nth row from the rows satisfying the WHERE clause, where n is a parameter I specify at the time of SELECT? Or equally acceptable to return a random sample of size n% from the rows satisfying the WHERE clause? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Not directly as far a I know, although if you can use triggers, you could investigate the use of SPL (Stored Procedures) which will be able to do what you want. Mark Denham BBC London, UK Mark.Denham@bbc.co.uk