Search code examples
oracle-databasedatabase-administration

How to identify all global temporary tables


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!


Solution

  • 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)