Hi Patrick,
You mentioned that separating the two SQL statements with each SQL execution runs for 2 seconds.
Can you try to use UNION and see how long it takes?
For example:
select a.CUSTOMER
from table1 a where a.XYZ is not NULL
UNION
select b.CUSTOMER
from table2 b join table 1 a on b.XYZ=a.XYZ WHERE a.XYZ is NULL
Regards,
Ferry