12.07.2015 Views

General Error Messages - InterSystems Documentation

General Error Messages - InterSystems Documentation

General Error Messages - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2SQL <strong>Error</strong> <strong>Messages</strong>The table below lists the SQL numeric error codes and their error messages. These codes are returned as the SQLCODEvariable value.Note:While this document lists error codes as negative values, JDBC and ODBC clients always receive positive values.For example, if an ODBC or JDBC application returns error code 30, look up error code -30 in this table.2.1 SQLCODE 0 and 100There are two SQLCODE values that do not represent an SQL error:• SQLCODE=0 indicates successful completion of an SQL operation. For a SELECT statement, this usually means thesuccessful retrieval of data from a table. However, if the SELECT performs an aggregate operation, (for example:SELECT SUM(myfield)) the aggregate operation is successful and an SQLCODE=0 is issued even when there isno data in myfield; in this case SUM returns NULL and %ROWCOUNT=1.• SQLCODE=100 indicates that the SQL operation was successful, but found no data to act upon. This can occur for anumber of reasons. For a SELECT these include: the specified table contains no data; the table contains no data thatsatisfies the query criteria; or row retrieval has reached the final row of the table. For an UPDATE or DELETE theseinclude: the specified table contains no data; or the table contains no row of data that satisfies the WHERE clausecriteria. In these cases %ROWCOUNT=0.2.2 Retrieving SQL Message TextsTo determine the meaning of an SQLCODE numeric code, use the following Caché ObjectScript statement:WRITE "SQLCODE=",$SYSTEM.SQL.SQLCODE(-nnn)This SQLCODE() method can also be called as a stored procedure from ODBC or JDBC: %SYSTEM.SQL_SQLCODE(-nnn).When possible (usually at SQL compile time), error messages include the name of the field, table, view, or other elementthat caused the error. Placeholders for these names are shown using the syntax convention.The %msg variable may contain an additional message error text for certain errors. For further details, refer to SystemVariables in the “Using Embedded SQL” chapter of Using Caché SQL.Caché <strong>Error</strong> Reference 79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!