How to identify all global temporary tables

Michal Hruška picture Michal Hruška · Dec 6, 2016 · Viewed 15.2k times · Source

I need to identify which tables in my schema are Global Temporary Tables. Following script returns names of all my tables, but I am not able to identify which of these are GTTs and which are not.

SELECT OBJECT_NAME
FROM ALL_OBJECTS 
WHERE OBJECT_TYPE IN ('TABLE')
AND OWNER='owner_name';

Thank you!

Answer

Praveen picture Praveen · Dec 6, 2016

You can use ALL_TABLES

select table_name
from all_tables
where TEMPORARY = 'Y'
AND OWNER='owner_name';

Temporary column indicates whether the table is temporary (Y) or not (N)