Common SQL Errors

DB2 SQLCODE -805 Error Explained and Fixed

June 25, 2025

SQLCODE -805 means Db2 cannot locate or execute the required package for a statement.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is DB2 SQLCODE -805?

DB2 SQLCODE -805 indicates that the required package (DBRM) was not found or is invalid. Rebind the application package or add the correct collection to CURRENT PACKAGE PATH to resolve the error.

Error Highlights

Typical Error Message

DBRM OR PACKAGE NAME location.collection.program.consistency-token NOT FOUND IN PLAN plan-name. REASON 805

Error Type

Package/Binding Error

Language

IBM Db2

Symbol

Error Code

SQL State

Explanation

Table of Contents

What does DB2 SQLCODE -805 mean?

SQLCODE -805 fires when Db2 cannot find or use the package containing the executable form of an SQL statement. The message identifies the missing location, collection, program, and consistency token, pinpointing the exact package Db2 expected.

Because the package is missing, invalid, or not in the active search path, Db2 halts the statement with -805 to prevent ambiguous execution.

Fixing the path or rebinding the package removes the error immediately.

When does this error occur?

The error appears at run time, not bind time.

It commonly surfaces in stored procedures, dynamic SQL issued from applications, and during remote calls over Db2 Connect where package collections differ between client and server.

It also occurs after program migrations when the load module contains a consistency token that no longer matches the bound package in the catalog.

Why is it important to resolve -805 quickly?

Failing SQL statements can cascade, breaking transactions, batch jobs, or web requests.

For OLTP systems, repeated -805 errors flood logs and consume CPU as Db2 repeatedly searches for missing packages. Prompt resolution restores performance and stability.

.

Common Causes

Missing or Dropped Package

The package named in the error has never been bound, or someone accidentally ran FREE PACKAGE, leaving no executable copy.

Wrong Collection ID

The package exists but in a different collection than the CURRENT PACKAGE PATH used for the connection, so Db2’s search order fails to locate it.

Consistency Token Mismatch

The program was relinked or recompiled, altering the timestamp token.

The existing package points to the old token, so Db2 treats it as a different object.

Incorrect Plan or NULLID Packages

For DRDA connections, the NULLID packages (e.g., NULLID.SYSLH000) may be missing or at the wrong APPLCOMPAT level, causing -805 for dynamic SQL.

.

Related Errors

FAQs

Is SQLCODE -805 a compile-time or run-time error?

It is a run-time error that appears when the application issues a statement and Db2 cannot find a usable package.

Can I ignore the consistency token?

No. The consistency token ensures the program and package match exactly. Rebinding without matching tokens can cause -818 or logical errors.

How does Galaxy help avoid -805?

Galaxy’s AI copilot warns when executing SQL against packages that are missing or out of scope and suggests the correct SET CURRENT PACKAGE PATH statement before you run the query.

Does rebinding affect performance?

Rebinding updates access paths but usually improves performance by enabling current statistics. Always rebind during maintenance windows in production.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo