Query for finding Journals with no attachments
I am trying to get query written up that will find manual journals that are posted and do not have attachments. So far I have:
select * from gl_je_batches
where je_batch_id in
(select pk1_value
from fnd_attached_documents
WHERE entity_name = 'GL_JE_HEADERS')
and
select * from gl_je_headers
where JE_batch_id = 9975
and je_batch_id in
(select pk2_value
from fnd_attached_documents
WHERE entity_name = 'GL_JE_HEADERS');
The 2nd one will be blank if my JE_BATCH_ID does not have an attachment. However, I am trying to get it to show all journals that do not have an attachment and this is where I am getting stuck.