Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

while loop in plsql

933417Jul 12 2012 — edited Aug 8 2012
Hi ,

I execute the below code in TOAD.


DECLARE
CURSOR c1
IS
SELECT *
FROM tab
WHERE ROWNUM < 5;

cd c1%ROWTYPE;
BEGIN
OPEN c1;

FETCH c1
INTO cd;

WHILE c1%FOUND
LOOP
DBMS_OUTPUT.put_line ( 'tname '
|| cd.tname
|| ' tabtype '
|| cd.tabtype
);
END LOOP;
-- FETCH c1
-- INTO cd;

END;


And got the below error..


Error at line 2
ORA-20000: ORU-10027: buffer overflow, limit of 20000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at line 19


If I add another FETCH INTO statement in the while loop block ,I will get the output.
But please let me know why I am getting this error exactly and how another FETCH INTO is preventing it.



Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 5 2012
Added on Jul 12 2012
10 comments
2,543 views