public class OracleDatabaseException extends Exception
try{ myStatement.executeUpdate(); } catch (SQLException sqlx) { if(sqlx.getCause() != null && sqlx.getCause() instanceof OracleDatabaseException) { int sqlErrorPosition = ((OracleDatabaseException)sqlx.getCause()).getErrorPosition(); } }
Constructor and Description |
---|
OracleDatabaseException(int errorPosition,
int oracleErrorNumber,
String oracleErrorMessage,
String sql,
String originalSql) |
OracleDatabaseException(int errorPosition,
int oracleErrorNumber,
String oracleErrorMessage,
String sql,
String originalSql,
boolean isSqlRewritten) |
Modifier and Type | Method and Description |
---|---|
int |
getErrorPosition()
In case of a parsing error, this method returns the position of the
error in the actual SQL which has failed in the server.
|
int |
getOracleErrorNumber()
Returns the Oracle error number for this failure.
|
String |
getOriginalSql()
Returns the original SQL used to create the Statement.
|
String |
getSql()
Returns the actual SQL which was sent to the server.
|
boolean |
isSqlRewritten()
Returns
true if the executed SQL includes expressions that were
added by the Oracle JDBC Driver, such as a ROWID in the SELECT
clause, or a RETURNING ... |
String |
toString() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
public OracleDatabaseException(int errorPosition, int oracleErrorNumber, String oracleErrorMessage, String sql, String originalSql)
public int getErrorPosition()
getSql()
. It may be different from
the original SQL returned by getOriginalSql()
.public int getOracleErrorNumber()
public String getSql()
public String getOriginalSql()
getSql()
. The method
getErrorPosition()
returns the position of the
error in the actual SQL sent to the database, not the original
SQL returned by this method.public boolean isSqlRewritten()
true
if the executed SQL includes expressions that were
added by the Oracle JDBC Driver, such as a ROWID
in the SELECT
clause, or a RETURNING ... INTO ...
clause for DML that
returns generated values.true
if the SQL was rewritten by the driver, otherwise
returns false
.