Skip to main content

SQLCODE Error Codes

SQL error codes.

Description

Attempting to execute most InterSystems SQL operations issues an SQLCODE value. The SQLCODE values issued are 0, 100, and negative integer values.

  • SQLCODE=0 indicates successful completion of an SQL operation. For a SELECT statement, this usually means the successful 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 is no 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 a number of reasons. For a SELECT these include: the specified table contains no data; the table contains no data that satisfies the query criteria; or row retrieval has reached the final row of the table. For an UPDATE or DELETE these include: the specified table contains no data; or the table contains no row of data that satisfies the WHERE clause criteria. In these cases %ROWCOUNT=0.

  • SQLCODE=-n indicates an error. The negative integer value specifies the kind of error that occurred. SQLCODE=-400 is a general purpose fatal error code.

For further details on SQLCODE error codes and the corresponding error messages, and a full list of SQLCODE error code values, refer to SQL Error Messages.

FeedbackOpens in a new tab