Learn it on Mainframe Path. Do it with MainframeKit.Learn on Mainframe Path ▸
MainframeKit

-104

SQLSTATE 42601NEGATIVE SQLCODE

Db2 hit a symbol it did not expect while reading the SQL statement. The real mistake is often earlier than the symbol it names.

MOST LIKELY

A keyword or clause earlier in the statement is missing, so a later symbol looks out of place.

FIRST CHECK

Read the token in the message and find it in the statement text.

TRY IT ▸

Site search

What it means

Db2 reads the statement from left to right. When it meets a symbol that does not fit, it stops and returns -104 with SQLSTATE 42601. The message names that symbol as the token. The statement is not run.

The named token is only where Db2 noticed the problem. The cause may sit before it, for example a keyword that was left out. The same code is also returned when ROLLBACK TO SAVEPOINT is written without a savepoint name.

Typical causes

  • A keyword or clause earlier in the statement is missing, so a later symbol looks out of place.
  • A symbol appears where the statement format does not allow it.
  • ROLLBACK TO SAVEPOINT was coded without naming the savepoint.

How to fix it

  1. Read the token in the message and find it in the statement text.
  2. Check the text just before that token, not only the token itself.
  3. For a savepoint rollback, add the savepoint name.
  4. Correct the statement and run it again.

Example

Illustrative only; names and values are invented.

DSNT408I SQLCODE = -104, ERROR:  ILLEGAL SYMBOL "FORM"
DSNT418I SQLSTATE   = 42601 SQLSTATE RETURN CODE