Reputation: 37
In Postgres I may use something like
select count(p1.*) from pg_partitions p1
where p1.tablename = 'table_name';
How to write query that counts NO of partitions for specific table in oracle? What is oracle equivalent of pg_partitions ?
Upvotes: 1
Views: 2700
Reputation: 8518
Depending on which privileges you have
Partitions of a table you own
select count(*) from user_tab_partitions where table_name = yourtable;
Partitions of a table you own or you have privilege to see it
select count(*) from all_tab_partitions where table_name = yourtable and table_owner = ownerofthetable ;
If you have privilege select any dictionary
or select catalog role
, or a granted privilege over the specific dba_tab_partitions
view , then
select count(*) from dba_tab_partitions where table_name = yourtable and table_owner = ownerofthetable ;
Upvotes: 2