# SQLCODE -909: Object deleted or altered

Source: https://wndsoftware.com/mainframe-errors/sqlcode-909

### SQLCODE -909: Object deleted or altered

SQLCODE -909 (SQLSTATE 57007) means the program dropped or altered a table or index, or ran EXCHANGE on a table, and then tried to use that table before committing. Db2 won't let the same program use an object it just changed that way.


#### Other names for this code

Also written as `SQL -909`, `SQLCODE=-909`, `SQLCODE = -909`, `db2 -909`, `sqlstate 57007`, `SQL0909N`, `the object has been deleted or altered`.


### What it means

DROP, ALTER and EXCHANGE change the definition or the identity of an object. Until the change is committed, Db2 doesn't let the program that made it go back and read or change that object. A statement that tries gets -909.

Db2 for z/OS lists four ways to hit it.

- The program dropped or altered a table, then accessed it.
- It dropped or altered an index, then accessed the table the index was on.
- It ran EXCHANGE on a table twice with no COMMIT between them.
- It ran EXCHANGE on a table, then accessed that table.

EXCHANGE swaps the data of a base table and its clone. Shops use it to load a clone and switch it in, which is why -909 often turns up in reload jobs.

Db2 for LUW uses SQL0909N with the same SQLSTATE when a program uses a table it dropped.


### Common causes

- A batch step drops and recreates a table, or alters it, then reads or loads it before a COMMIT.
- A program drops an index and then queries the table that index belonged to.
- A clone-table reload job runs EXCHANGE and then reads the base table in the same unit of work.
- A job runs two EXCHANGE statements on the same table without a COMMIT between them.
- A tool that runs a script with autocommit off issues DDL and queries in one unit of work.


### How to find the problem

- Find the failing statement and the object it names.
- Look earlier in the same unit of work for DROP, ALTER or EXCHANGE against that table or one of its indexes.
- Check where the last COMMIT happened. In SPUFI or a script runner, check the autocommit setting.


### How to fix it

- Add a COMMIT after the DROP, ALTER or EXCHANGE and before the next statement that uses the object.
- Put a COMMIT between consecutive EXCHANGE statements on the same table.
- Split DDL and the work that uses the object into separate steps or units of work.
- Turn autocommit on for scripts that mix DDL and queries, or add explicit COMMIT statements.


### What it looks like


```text
DSNT408I SQLCODE = -909, ERROR:  THE OBJECT HAS BEEN DELETED OR ALTERED
DSNT418I SQLSTATE   = 57007 SQLSTATE RETURN CODE
```


### IBM documentation

[IBM documentation: -909](https://www.ibm.com/docs/en/db2-for-zos/13.0.0?topic=codes-909). Use the documentation for your installed release.

[Report a correction to WND Software](https://wndsoftware.com/contact#message).

Technical reviewer: [Albert Joseph](https://wndsoftware.com/authors/albert-joseph), WND Software.

Last reviewed 2026-10-18 by the WND Software team. Written in our own words. For the full reference, check IBM’s Db2 for z/OS documentation for your release.


### Related codes

[SQLCODE -204 Undefined object name Read →](https://wndsoftware.com/mainframe-errors/sqlcode-204)
[SQLCODE -904 Resource unavailable Read →](https://wndsoftware.com/mainframe-errors/sqlcode-904)
[SQLCODE -911 Deadlock or timeout, rolled back Read →](https://wndsoftware.com/mainframe-errors/sqlcode-911)
[SQLCODE -501 Cursor not open Read →](https://wndsoftware.com/mainframe-errors/sqlcode-501)

### Questions


#### Does -909 mean the table is gone?

Not always. After an ALTER or EXCHANGE the table still exists. Db2 just won't let the same unit of work use it until a COMMIT.


#### Why does it happen in clone reload jobs?

Those jobs run EXCHANGE to switch the clone in. Reading the table, or running a second EXCHANGE, before a COMMIT gives -909.


#### Is a COMMIT always the fix?

For the cases Db2 lists, yes. Commit after the DROP, ALTER or EXCHANGE, then use the object.

[Db2 SQLCODEs](https://wndsoftware.com/mainframe-errors/db2-sqlcodes) · [SQLCODE -906](https://wndsoftware.com/mainframe-errors/sqlcode-906) · [SQLCODE -911](https://wndsoftware.com/mainframe-errors/sqlcode-911)

[← All error codes](https://wndsoftware.com/mainframe-errors/)
