well I'm pretty new to plSQL and I can't seem to figure out some errors I'm getting while trying to generate a pascal's triangle
Here's the code:
SET SERVEROUTPUT ON;
DECLARE
N NUMBER;
I NUMBER;
J NUMBER;
K NUMBER;
L NUMBER;
T NUMBER;
S NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE('ENTER THE LIMIT');
N:=&N;
I:=0;
T:=N-2;
S:=0;
L:=0;
WHILE (I<N) LOOP
J:=0;
WHILE (J<T) LOOP
DBMS_OUTPUT.PUT(' ');
J:=J+1;
END LOOP;
K:=0;
WHILE (K<=S) LOOP
IF (K<=I) THEN
DBMS_OUTPUT.PUT(K+1);
L:=K;
ELSE
L:=L-1;
DBMS_OUTPUT.PUT(L+1);
END IF;
K:=K+1;
END LOOP;
DBMS_OUTPUT.PUT_LINE('');
T:=T-1;
S:=S+2;
END LOOP;
END;
The errors are
Error report - ORA-20000: ORU-10027: buffer overflow, limit of 1000000 bytes ORA-06512: at "SYS.DBMS_OUTPUT", line 32 ORA-06512: at "SYS.DBMS_OUTPUT", line 97 ORA-06512: at line 29 20000. 00000 - "%s" *Cause: The stored procedure 'raise_application_error' was called which causes this error to be generated. *Action: Correct the problem as described in the error message or contact the application administrator or DBA for more information.
Neither I
nor N
are ever updated, so you have an infinite loop. Other than that, the error is indicating that the DBMS_OUTPUT buffer is being exceeded. It's default buffer size is 1,000,000 bytes, though you can adjust that with an appropriate DBMS_OUTPUT.ENABLE call or SET SERVEROUTPUT SIZE statement.