If I was a betting man, I'd say the culprit is
SELECT COUNT(*)
INTO bcount
FROM vam_ledger
WHERE party = tparty
AND vchtype IN('BA', 'CA')
AND vchno = c2.vchno;


Since you are only interested in whether there are zero rows or not, do a simple
SELECT count(*) INTO bcount
FROM DUAL WHERE EXISTS (SELECT 1 FROM vam_ledger
WHERE party = tparty
AND vchtype IN('BA', 'CA')
AND vchno = c2.vchno);
[There are other ways of writing that, but this has the smallest impact]