Subject RE: [firebird-support] NOT EXISTS returns 'no current record for fetch operation'
Author Rick Debay
In case anyone is confused as to what I'm trying to accomplish, it's an
outer join on line items where both sides match with no NULL items.
If my approach is poor, then I won't have to worry about question about
the exception.

SELECT po.ID, pb.ID
FROM
RPL_PO po
JOIN RPL_POBILL pb
ON pb.PO = po.ID
WHERE
NOT EXISTS (
SELECT 1
FROM RPL_PO_ITM poi
LEFT JOIN RPL_POBILL_ITM pbi
ON poi.NDC = pbi.NDC AND pbi.INVOICE = pb.ID
WHERE poi.PURCH_ORDER = po.ID
AND pbi.COST IS NULL
) AND
NOT EXISTS (
SELECT 1
FROM RPL_POBILL_ITM pbi
LEFT JOIN RPL_PO_ITM poi
ON pbi.NDC = poi.NDC AND poi.PURCH_ORDER = po.ID
WHERE pbi.INVOICE = pb.ID
AND poi.PRICE IS NULL
)


Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.