sql
UPDATE PERSON
SET ENROLMENT_DATE = CURRENT_TIMESTAMP
WHERE NOT EXISTS (SELECT * FROM FEE_PAYMENT WHERE FEE_PAYMENT.PERSON_ID = PERSON.PERSON_ID);
UPDATE PERSON
SET ENROLMENT_DATE = CURRENT_TIMESTAMP
WHERE PERSON_ID NOT IN (SELECT FEE_PAYMENT.PERSON_ID FROM FEE_PAYMENT);
Which one is better and why? I like the NOT IN in this case because it reads easier but I know I can have problems if I stumble upon a null value.
I guess your best option is to actually compare both versions of your code, check what explain plan says and then decide which one to use.
Though, note that - on small data sets - you won't notice any difference.
An alternative might also be merge, e.g.
Also, at the first sight, index on both
person_idcolumns would probably improve performance.