It depends on how many rows were processed by the last DML (in your case a query) processed. In your test, I would expect SQL%ROWCOUNT to return 1 since the select count returns 1 row (the count), but they are not reporting the same thing. However, you are also calling it inside the fnd_file procedure - and if that procedur runs a query, then it will most likely return that result, instead of what you are running. My suggestion would be make an anonymous block out of that section of code and replace all the fnd_file calls with dbms_output.put_line statements, and run it like that. This way you are not making any extra calls that are out of your control. Then you can narrow it down from there.
↧