Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-30 · container image gvenzl/oracle-free:23-slim
A global temporary table (GTT) created ON COMMIT PRESERVE ROWS keeps its rows until the session ends. While any session has rows in it, the table counts as "in use" and DDL such as DROP TABLE or CREATE INDEX fails with ORA-14452.
The message talks about an index, but in the lab a plain DROP TABLE raised the same error. The session that blocks it can be your own: both cases below used a single session.
01DROP TABLE on a GTT that still has rows in this session
tmp_calc is a GTT with ON COMMIT PRESERVE ROWS. The session inserted a row, committed, and ran DROP TABLE tmp_calc. It failed with ORA-14452, even though no index was involved.
user_tables showed TEMPORARY = Y and DURATION = SYS$SESSION: the committed row stays for the whole session, so the table was still in use.
Running TRUNCATE TABLE tmp_calc first removed this session's rows, and DROP TABLE tmp_calc then succeeded (Table dropped).
Setup
CREATE GLOBAL TEMPORARY TABLE tmp_calc (id NUMBER, amount NUMBER) ON COMMIT PRESERVE ROWS;Table created.INSERT INTO tmp_calc VALUES (1, 100);
COMMIT;
DROP TABLE tmp_calc;1 row created.
Commit complete.
DROP TABLE tmp_calc
*
ERROR at line 1:
ORA-14452: attempt to create, alter or drop an index on temporary table already in use
Help: https://docs.oracle.com/error-help/db/ora-14452/COLUMN table_name FORMAT A10
COLUMN duration FORMAT A15
SELECT table_name, temporary, duration FROM user_tables WHERE table_name = 'TMP_CALC';TABLE_NAME T DURATION
---------- - ---------------
TMP_CALC Y SYS$SESSION
1 row selected.TRUNCATE only clears the current session's rows. If other sessions still hold rows, they must truncate or disconnect before the DROP can work.
INSERT INTO tmp_calc VALUES (1, 100);
COMMIT;
TRUNCATE TABLE tmp_calc;
DROP TABLE tmp_calc;1 row created.
Commit complete.
Table truncated.
Table dropped.02CREATE INDEX on a GTT after rows were inserted
The same GTT got a row and a COMMIT, then CREATE INDEX tmp_calc_ix ON tmp_calc (id) failed with ORA-14452. The check again showed DURATION = SYS$SESSION.
In a new session the index was created before any data went in (Index created), and inserting and committing afterwards worked. user_indexes listed TMP_CALC_IX.
Setup
CREATE GLOBAL TEMPORARY TABLE tmp_calc (id NUMBER, amount NUMBER) ON COMMIT PRESERVE ROWS;Table created.INSERT INTO tmp_calc VALUES (1, 100);
COMMIT;
CREATE INDEX tmp_calc_ix ON tmp_calc (id);1 row created.
Commit complete.
CREATE INDEX tmp_calc_ix ON tmp_calc (id)
*
ERROR at line 1:
ORA-14452: attempt to create, alter or drop an index on temporary table already in use
Help: https://docs.oracle.com/error-help/db/ora-14452/COLUMN table_name FORMAT A10
COLUMN duration FORMAT A15
SELECT table_name, temporary, duration FROM user_tables WHERE table_name = 'TMP_CALC';TABLE_NAME T DURATION
---------- - ---------------
TMP_CALC Y SYS$SESSION
1 row selected.Create a GTT's indexes together with the table, in a deployment script, before any program session puts data in it.
CREATE INDEX tmp_calc_ix ON tmp_calc (id);
INSERT INTO tmp_calc VALUES (1, 100);
COMMIT;
SELECT index_name FROM user_indexes WHERE table_name = 'TMP_CALC';Index created.
1 row created.
Commit complete.
INDEX_NAME
------------------------------
TMP_CALC_IX
1 row selected.FAQ
Why does DROP TABLE give ORA-14452 when I am not touching an index?
ORA-14452 is raised for DDL on a temporary table that is in use. In the lab, DROP TABLE on a GTT with a committed row (ON COMMIT PRESERVE ROWS) failed with this exact message.
How do I drop a global temporary table that is in use?
In each session that has rows in it, run TRUNCATE TABLE (or end the session), then drop it. In the lab, TRUNCATE followed by DROP in the same session worked.
Can I add an index to a global temporary table that already has data?
Not while a session has rows in it. In the lab, CREATE INDEX failed after an insert, but succeeded in a fresh session before any data was inserted.
What does DURATION SYS$SESSION mean in user_tables?
The GTT was created ON COMMIT PRESERVE ROWS, so rows stay until the session ends.
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0