I frequently get this error (it is so annoying!):
Error report: ORA-06502: PL/SQL: numeric or value error: character
string buffer too small ORA-06512: at line 305
06502. 00000 – “PL/SQL: numeric or value error%s”
Example stored procedure is looping through a cursor (that has approx 10k rows), doing some logic and then using dbms_output.put_line to print each record to the 'Script Output' tab in Oracle SQL Developer.
Is there a way to flush out the the buffer or prevent this error coming up (and aborting the rest of the proc)?
If that is possible I could use the Mod function to clear the buffer every 10 or so rows processed.
The default buffer size of
DBMS_OUTPUTis 20000 chars. You can up this with:There’s no concept of a “flush” as there is nothing to flush to until the stored procedure returns. The way it actually works is that the lines go into a buffer in the DB, then that buffer is explicitly fetched (with
DBMS_OUTPUT.GET_LINES) by the client (e.g. SQL*Plus) when the SP completes. It is quite unlikeprintf()that you might be used to in C.