I am using Oracle/MyBatis and trying to debug a stored procedure with an enormous amount of parameters. Inside the stored procedure I get a ORA-01438: value larger than specified precision allowed for this column
So my initial approach would be to do like dbms_output.put_line in the stored procedure to try to see what the values are right before the offending statement. Without MyBatis, I would ordinarily open up a sqlplus script and type set serveroutput on and then run my stored procedure at some later point to see all the debug messages come out. With MyBatis, I cannot figure out how (if possible) to get these debug statements.
I have the ibatis and sql debuggers set for DEBUG and I use log4j to log everything for my Tomcat 6 application.
The
DBMS_OUTPUTpackage has a few other procedures that you could use.DBMS_OUTPUT.ENABLEfunctions much like the SQL*Plus commandset serveroutput onin that it allocates a buffer forDBMS_OUTPUT.PUT_LINEto write to.DBMS_OUTPUT.GET_LINEcan be used to fetch the data written to that buffer by previous calls toDBMS_OUTPUT.PUT_LINE. So it should be possible to call theENABLEfunction, call the procedure which writes a number of lines to the buffer, and then callGET_LINE(orGET_LINES) to fetch the data that was written to theDBMS_OUTPUTbuffer and write that data to your logs.It may be simpler, however, to redirect the logging to an Oracle database table rather than trying to use
DBMS_OUTPUT. One common approach is to create your own package that has a switch to determine whether to write toDBMS_OUTPUTor whether to write to a table. Something like