What's the difference between ALL_TABLES and ALL_ALL_TABLES
Answer:
1) Both views provide all tables to which the current user has access to but, in addition to the tables returned by ALL_TABLES, the ALL_ALL_TABLES will also return all object tables (system generated or not) accessible by the current user.
2) The following 3 columns that appear only in ALL_ALL_TABLES, but not in ALL_TABLES
give you details about the object type on which the object table was created and the object identifier type used:
OBJECT_ID_TYPE
TABLE_TYPE_OWNER
TABLE_TYPE
If you want to see the difference only between the two views, you can use a select like
the following:
SELECT * FROM ALL_ALL_TABLES
WHERE TABLE_TYPE IS NOT NULL
/
Even if you don't have object tables in your schemas, you will probably still see some of the object tables used by different Oracle features installed, like XDB, a.s.o.
3) ALL_ALL_TABLES includes object tables as well as relational tables.
Also, this may be an interview question (e.g. how can you get all tables you have access to?) and you may leave a good impression if you respond with another question: "Do you also want object tables to be included?". :)
Answer:
1) Both views provide all tables to which the current user has access to but, in addition to the tables returned by ALL_TABLES, the ALL_ALL_TABLES will also return all object tables (system generated or not) accessible by the current user.
SQL> select *
2 from dictionary
3 where table_name in ('TABS','ALL_TABLES','ALL_ALL_TABLES')
4 /
TABLE_NAME COMMENTS
-------------------- ------------------------------------------------------------------------------------------------
ALL_ALL_TABLES Description of all object and relational tables accessible to the user
ALL_TABLES Description of relational tables accessible to the user
TABS Synonym for USER_TABLES
2) The following 3 columns that appear only in ALL_ALL_TABLES, but not in ALL_TABLES
give you details about the object type on which the object table was created and the object identifier type used:
OBJECT_ID_TYPE
TABLE_TYPE_OWNER
TABLE_TYPE
If you want to see the difference only between the two views, you can use a select like
the following:
SELECT * FROM ALL_ALL_TABLES
WHERE TABLE_TYPE IS NOT NULL
/
Even if you don't have object tables in your schemas, you will probably still see some of the object tables used by different Oracle features installed, like XDB, a.s.o.
3) ALL_ALL_TABLES includes object tables as well as relational tables.
Also, this may be an interview question (e.g. how can you get all tables you have access to?) and you may leave a good impression if you respond with another question: "Do you also want object tables to be included?". :)
Now in 2023... 10 years later !!! This still works, thanks man :D
ReplyDelete