Thank you. I don't know then why is it working fine when I have the hard coded parameter value in the query.
I noticed one more thing. I input the parameter so that query just has to run 100 records. It was still not working. Then I added "And rownum < 500) and the query worked. I don't know what's going on here. The cost of both the queries was exactly same.
FROM TABLE_A ss, TABLE_B sc, TABLE_C pse, TABLE_D ps
WHERE ss.hnspartnerid = sc.swcustomerid
and sc.COMPANY = <Parameters.CustomerID>
and ss.SITE = pse.SRCSITE
and pse.SITE = ps.SITE
AND ss.ACTTYPE <> 'Physical Location'