This content has been marked as final. Show 2 replies
Welcome to the forum!
Whenever you post provide your 4 digit Oracle version.
No - it won't be the same based on the code you posted.
The first set of code has this:
You used 'put' and not 'put_line' like you used in the second set of code.
10 dbms_output.put('A' || ftable.count || ' ');
The problem you mentioned though is because in the second set of code you have this
You are using 'put_line' to output that last 'name' even though there weren't any more rows fetched.
8 fetch fcursor into ftable; 9 dbms_output.put_line(ftable.name); 10 exit when fcursor%notfound;
You need to check the '%notfound' IMMEDIATELY AFTER the FETCH when you fetch a single row. You put the check at the END of the loop if you do a BULK COLLECT.
Everything is working as expected.
Thank you for your replying.
I just have turned the 'put' to the 'put_line' and the output was as what I expected. So it means that the 'put' would not flush the cache immediately. I should use the 'put' carefully.