I am trying to do the following.

I have a table called srp_classmask in one database with the following attributes: (id, classmask_id).

I created another table in different database called ref_classmask with the following attributes: (id, classmask_id, description, date_inserted, date_updated)

(I will use db link)

I am trying (without luck so far) to do the following with PL/SQL.

- get distinct values from srp_classmask table

SELECT distinct classmask_id
FROM srp_classmask

- check if classmask_id from srp_classmask table exists in ref_classmask table.

- if new value exists, insert the new found srp_classmask.classmask_id into ref_classmask table VALUES (id_seq.NEXTVAL, srp_classmask.classmask_id, NULL, sysdate, null)

- send email to bla@bla.com, with summary information (new classmask_ids inserted into the ref_classmask table).

If someone could give me some pointers that would be great.

Thank You