HI, I'm using sqlloader to insert data into a table. I have created a compiled and valid trigger that won't trip. I would like the trigger to see if the row already exists on the table (I have a 4 column primary key) if it already exists update it. But if it doesn't exist insert it. I am loading in 10 dummy records, 5 are updates and 5 are inserts. So after the load there should only be 5 new records but there are 10. It seems that it is inserting all 10 no matter what the trigger is set up to do. Here is my sql, any help would be greatly appreciated. This is the first trigger I have ever written and I know no plsql.

CREATE OR REPLACE TRIGGER COMP_DATA_TRIG
INSTEAD OF INSERT ON COMP_DATA_VW
REFERENCING NEW AS n
FOR EACH ROW
DECLARE
rowcnt number;
BEGIN
SELECT COUNT(*) INTO rowcnt FROM comparison_data
WHERE rfp_id = :n.rfp_id
and option_id=:n.option_id
and coverage_id=:n.coverage_id
and network_type_id=:n.network_type_id;
IF rowcnt >0 THEN
UPDATE comparison_data
SET
value = :n.value,
unit_of_measure_id = :n.unit_of_measure_id,
comparison_descr = :n.comparison_descr,
created_on = :n.created_on,
created_by = :n.created_by,
cost_type_id = :n.cost_type_id,
copay_coins = :n.copay_coins,
last_updated_on = :n.last_updated_on,
last_updated_by = :n.last_updated_by,
category = :n.category
WHERE rfp_id = :n.rfp_id
and coverage_id = :n.coverage_id
and option_id = :n.option_id
and network_type_id = :n.network_type_id;
ELSE
INSERT INTO comparison_data
(rfp_id,option_id, coverage_id, network_type_id, value, unit_of_measure_id, comparison_descr, created_on, c
reated_by, cost_type_id, copay_coins, last_updated_on, last_updated_by, category)
VALUES (:n.rfp_id, :n.option_id, :n.coverage_id, :n.network_type_id, :n.value, :n.unit_of_measure_id, :n.comp
arison_descr, :n.created_on, :n.created_by, :n.cost_type_id, :n.copay_coins, :n.last_updated_on, :n.last_upda
ted_by, :n.category);
END IF;
END;
/