public class OracleDatabaseException
extends java.lang.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,
java.lang.String oracleErrorMessage,
java.lang.String sql,
java.lang.String originalSql) |
OracleDatabaseException(int errorPosition,
int oracleErrorNumber,
java.lang.String oracleErrorMessage,
java.lang.String sql,
java.lang.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.
|
java.lang.String |
getOriginalSql()
Returns the original SQL used to create the Statement.
|
java.lang.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 ... |
java.lang.String |
toString() |
public OracleDatabaseException(int errorPosition, int oracleErrorNumber, java.lang.String oracleErrorMessage, java.lang.String sql, java.lang.String originalSql)
public OracleDatabaseException(int errorPosition, int oracleErrorNumber, java.lang.String oracleErrorMessage, java.lang.String sql, java.lang.String originalSql, boolean isSqlRewritten)
public int getErrorPosition()
getSql()
. It may be different from
the original SQL returned by getOriginalSql()
.public int getOracleErrorNumber()
public java.lang.String getSql()
public java.lang.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
.public java.lang.String toString()
toString
in class java.lang.Throwable