I am new in Oracle DB. We are using Toad for Oracle. I need to implement a deduplication trigger for our table. It's an alarms table and a third party vendor will be sending alarms to our database. Basically, it's a catch-all alarms. Duplicates are those with the same IP, alarm remarks and severity.
Sample data:
INSERT INTO t_alarms (IP, remarks, severity) VALUES ('10.10.10.10', 'VOICESERVER IS DOWN', '5')
INSERT INTO t_alarms (IP, remarks, severity) VALUES ('10.10.10.10', 'VOICESERVER IS DOWN', '5')
INSERT INTO t_alarms (IP, remarks, severity) VALUES ('10.10.10.19', 'VOICESERVER IS DOWN', '5')
INSERT INTO t_alarms (IP, remarks, severity) VALUES ('10.10.10.19', 'VOICESERVER IS DOWN', '5')
And then my table looks like this:
IP REMARKS SEVERITY TALLY FIRSTOCCUR LASTOCCUR
10.10.10.10 'VOICESERVER IS DOWN' 5 2 2/21/2014 01:00:03 2/22/2014 02:00:03
10.10.10.19 'VOICESERVER IS DOWN' 5 2 2/21/2014 06:00:03 2/22/2014 06:30:03
where: Tally is the count of how many times my alarms happen FirstOccur is the date/time when it first inserted/happen LastOccur is the date/time when it last occur
Is there a way or a script to implement this dedupe process through triggers?