Ask the Expert

Trigger with select

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?

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: