Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORACLE UPDATE TRIGGER USE OF A CURSOR

Status
Not open for further replies.

glschill

MIS
Aug 29, 2001
6
US
Here's the scenario. I want to update a LAST_MODIFIED_DATE field in my table when only specifed fields are updated in a table and not others. So, of course, I use a trigger and I could easily hardcode each field in my trigger to something like:

IF :new.field1 <> :eek:ld.field1 THEN
SELECT sysdate
INTO :new.LAST_MODIFIED_DATE
FROM dual;
END IF;

IF :new.field2 <> :eek:ld.field2 THEN
SELECT sysdate
INTO :new.LAST_MODIFIED_DATE
FROM dual;
END IF;

Easy enough. Want I really want to do is to store each field name in a table, return a cursor containing the field names, and loop through the cursor instead of hardcoding each and every field separately. Is something like this possible?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top