Ok i'm not very experienced with oracle triggers,PL/SQL etc but I am learning, so bear with me
I have 2 tables involved in this situation, a source tabled called:
'dm_audittrail_s' and a destination table called 'rds_monitoring'
What I want to do is have a trigger on the dm_audittrail_s table to fire when a new record is inserted, and for that trigger to insert a new record on rds_monitoring. Simple yes? Well it gets more complex.
I want the trigger to only fire when a certain type of record is inserted - that is, there is an attribute in dm_audittrail_s called 'EVENT_NAME', which could be a variety of things but is always a string. I only want the trigger to fire when EVENT_NAME = 'dm_getfile'
I'm struggling to get it to do that at the moment ;/
this is the code that I have currently (abridged to only the relavent code)
The trigger is currently fireing on any event - not just dm_getfileCode:CREATE OR REPLACE TRIGGER rds_monitor_update AFTER INSERT ON dm_audittrail_s REFERENCING NEW AS newRow FOR EACH ROW WHEN (newRow.EVENT_NAME='dm_getfile') DECLARE <etc etc> BEGIN <etc etc> EXCEPTION <etc etc> END
anyone got any ideas at all?
Failing that any links to sites with lots of detail on triggers / plsql would be helpful, particularly with info about the when clause and the for each row clause (the oracle documentation is good, but could use more insight..)
Cheers in advance for any help
Spud/Pete