Numeric errors are handled by default as severity 10 in SAP Adaptive Server12.0 through 12.5.
A severity-level 10 message is classified as a status information message, not as an error, and its content is transferred in a SQLWarning object.
static void processWarnings(SQLWarning warning)
{
if (warning != null)
{
System.out.println ("\n -- Warning received -- \n");
}//end if
while (warning != null)
{
System.out.println ("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.println ("ErrorCode: " +
warning.getErrorCode());
System.out.println ("----------------------------");
warning = warning.getNextWarning();
}//end while
}//end processWarnings
while (rs.next())
{
String value = rs.getString(1);
System.out.println ("Fetched value: " + value);
// Check for SQLWarning on the result set.
processWarnings (rs.getWarnings());
}//end while
// Check for SQLWarning on the result set.
processWarnings (rs.getWarnings());
-- Warning received -- Message: Divide by zero occurred. SQLState: 01012 ErrorCode: 3607