while loop in plsql
933417Jul 12 2012 — edited Aug 8 2012Hi ,
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.