If the error has been performed in the database engine returns the SQL status code of the error. Otherwise, return null.
1 error.sqlstate
<error.sqlstate />
Returns | |
---|---|
Type | Description |
String | Returns the SQL status code of the error. |
Example
Copy
<xsql-script> <body> <try> <body> <!-- A exception in the database engine can be performed (description column does not exist) --> <insert table='cdiarios'> <column name='descri'>test</column> </insert> </body> <catch> <println>Error at line: <error.line/></println> <println>.......in tag: <error.tag/></println> <println>...root cause: <error.message/></println> <println>....sql code1: <error.sqlcode/></println> <println>...sql state1: <error.sqlstate/></println> </catch> </try> </body> </xsql-script>
Returns:
Copy
Error at line: 7 .......in tag: insert ...root cause: java.sql.SQLException: Column (descri) not found in any table in the query (or SLV is undefined)., Column (descri) not found in any table in the query (or SLV is undefined). ...node cause: java.sql.SQLException: Column (descri) not found in any table in the query (or SLV is undefined)., Column (descri) not found in any table in the query (or SLV is undefined). ....sql code1: -217 ....sql code2: -217 ...sql state1: IX000