Returns the requested detail about an exception.
Format
public String getDiagnostics(int diagType)
Returns
A string containing the information specified by the diagType parameter, as shown in the table below.
Parameters
diagType
One of the values shown in the following table.
Argument Values for DhSQLException.getDiagnostics
Argument Value |
Returns |
---|---|
RETURNED_SQLSTATE |
The SQLSTATE returned by execution of the previous SQL statement. |
MESSAGE_TEXT |
The condition indicated by RETURNED_SQLSTATE. |
CLASS_ORIGIN |
Not currently used. Always returns null. |
SUBCLASS_ORIGIN |
Not currently used. Always returns null. |
Throws
DhSQLException
Example
CREATE PROCEDURE test_proc()
BEGIN
String errstate;
String errmesg;
try
{
SQLIStatement insert_cust = new SQLIStatement ( "INSERT
INTO customer VALUES (1,2) ");
insert_cust.execute();
}
catch (DhSQLException e)
{
errstate = e.getDiagnostics (
DhSQLException.RETURNED_SQLSTATE) ;
errmesg = e.getDiagnostics (
DhSQLException.MESSAGE_TEXT) ;
}
END