23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Java Class <strong>Reference</strong><br />

246<br />

err<br />

Dh<strong>SQL</strong>Exception<br />

Writes a message to the log. The following Java classes write to the log:<br />

• <strong>SQL</strong>IStatement<br />

• <strong>SQL</strong>PStatement<br />

• <strong>SQL</strong>Cursor<br />

• Dh<strong>SQL</strong>Result Set<br />

• Dh<strong>SQL</strong>Exception<br />

Extends the general java.lang. exception class to provide detail about errors in <strong>SQL</strong> statement<br />

execution. Any such errors raise an exception with an argument that is an <strong>SQL</strong>Exception class<br />

object. The getDiagnostics() method retrieves details of the error.<br />

Constructors<br />

public Dh<strong>SQL</strong>Exception(int ecode, String errMsg)<br />

Parameters<br />

ecode<br />

errMsg<br />

The error number associated with the exception condition.<br />

The error message associated with the exception condition.<br />

Example In this example, the Dh<strong>SQL</strong>Exception constructor creates an exception object called excep and<br />

then throws the excep object under all conditions:<br />

CREATE PROCEDURE sp1_02()<br />

BEGIN<br />

// raising exception<br />

Dh<strong>SQL</strong>Exception excep = new Dh<strong>SQL</strong>Exception(666,new String<br />

("Entered the tst02 procedure"));<br />

if (true)<br />

throw excep;<br />

END<br />

Dh<strong>SQL</strong>Exception.getDiagnostics<br />

Returns the requested detail about an exception.<br />

Format<br />

public String getDiagnostics(int diagType)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!