The DhSQLException.err method can be used inside Java Stored Procedures and Java Database SQL Triggers. On invoking this method, error messages are written to the sqlNNNN.trc file. The sqlNNNN.trc file is created in the working directory and NNNN stands for the SQL server process PID. The following is an example of an error message:
DROP PROCEDURE Fix;
CREATE PROCEDURE Fix ()
IMPORT
import java.sql.*;
BEGIN
if (true) {
DhSQLException excep = new DhSQLException ( 666 , new String("Sample user defined new DhSQLException object") );
excep.err(excep.getDiagnostics(DhSQLException.RETURNED_SQLSTATE));
excep.err("\r");
excep.err(excep.getDiagnostics(DhSQLException.MESSAGE_TEXT));
excep.err("\r");
}
END;
COMMIT WORK;