Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.javatools.db.sql
Class InvalidSQLException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by oracle.javatools.db.DBException
              extended by oracle.javatools.db.sql.SQLQueryException
                  extended by oracle.javatools.db.sql.InvalidSQLException

All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SQLParseException

public class InvalidSQLException
extends SQLQueryException

SQLQueryException for representing errors in the sql (e.g. those that are syntax related). Also used to represent errors in sql run against the database.

Since:
11.1.1.2.0
See Also:
Serialized Form

Constructor Summary
InvalidSQLException(java.lang.String sql, java.lang.String message)
          Creates a new exception for the given sql.
InvalidSQLException(java.lang.String sql, java.lang.String message, java.lang.Integer offset)
          Creates a new exception for the given sql.

 

Method Summary
 java.lang.Integer getColumnNumber()
          Gets the column (char) number in the current line that the error occured at.
 java.lang.Integer getLineNumber()
          Gets the line number in the sql that the error occured at.
 java.lang.String getMessage()
           
 java.lang.Integer getOffset()
          Gets the offset that the first error occurs at in the sql.
 java.lang.String getSQL()
          Gets the invalid sql.
 java.lang.String getSQLWithError()
          Gets the query with the error offset highlighted (if the offset is known).

 

Methods inherited from class oracle.javatools.db.DBException
getNextException, getObject, setNextException

 

Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

InvalidSQLException

public InvalidSQLException(java.lang.String sql,
                           java.lang.String message)
Creates a new exception for the given sql.
Parameters:
sql - the sql that is invalid
message - the error message

InvalidSQLException

public InvalidSQLException(java.lang.String sql,
                           java.lang.String message,
                           java.lang.Integer offset)
Creates a new exception for the given sql.
Parameters:
sql - the sql that is invalid
message - the error message
offset - the offset in the sql that the error is at

Method Detail

getSQL

public java.lang.String getSQL()
Gets the invalid sql.
Returns:
the sql this exception contains the error details for

getOffset

public java.lang.Integer getOffset()
Gets the offset that the first error occurs at in the sql.
Returns:
the offset of the error, or null if the offset is not known

getLineNumber

public java.lang.Integer getLineNumber()
Gets the line number in the sql that the error occured at.

getColumnNumber

public java.lang.Integer getColumnNumber()
Gets the column (char) number in the current line that the error occured at.

getSQLWithError

public java.lang.String getSQLWithError()
Gets the query with the error offset highlighted (if the offset is known).

For example:

   select * frm employees
            ^
 
Returns:
the query text with the error highlighted, or just the original query if the error offset is unknown.

getMessage

public java.lang.String getMessage()
Overrides:
getMessage in class java.lang.Throwable

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.