How can I get position of an error in Oracle SQL query?

后端 未结 3 864
悲哀的现实
悲哀的现实 2021-01-18 05:52

How can I get position of an error in the query?

I need to get position in a query string which causes an error, like sqlplus does it:

S         


        
3条回答
  •  执念已碎
    2021-01-18 06:45

    The SQLException has additional fields that hold the SQL error number (as in ORA-12899) and a message something like what you see as value too large for column "schmnm"."tbl"."data" (actual: 5, maximum: 3)

    You have to parse the string if you want to truely pinpoint the error in the SQL statement.

    See: http://docs.oracle.com/javase/6/docs/api/java/sql/SQLException.html

    Read about the errorCode and SQLState properties within the exception.

提交回复
热议问题