Q

Trigger with select

Is there a way to build something like a trigger that works with a "select" sentence not with "update, delete, insert"?

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

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close