Is there a way to build something like a trigger that works with a "select" sentence not with "update, delete, insert"? I mean I want to do something when a table opens, something like this which is on IBM Informix:
CREATE TRIGGER hits_trig SELECT OF col_a ON tab_a
REFERENCING OLD AS hit
FOR EACH ROW (INSERT INTO hits_log
VALUES (hit.col_a, CURRENT, USER));
I have read that a like trigger doesn't exist, but I don't know, maybe there is like a stored procedure or something?
A trigger is an action that occurs in response to a specific event. Unfortunately, there are no SELECT triggers. If you want to determine who queried the table, you can set up auditing on that table. Read the Administrator's Guide for your version for more details. Auditing will not let you perform more complex logic like you can in a trigger.
This was first published in September 2006