set ver off;
set define on;

col owner format a15
col segment_name format a20
col subpartition_name format a30

define v_fr_owner=&1 ;
define v_fr_table=&2;
define v_fr_subpartition=&3;

select a.owner,a.segment_name,b.subpartition_name,
round(a.bytes/1024/1024,2) "alocatado (Mb)",round((b.num_rows*b.avg_row_len/1024/1024),2) "real(Mb)",
round(a.bytes/1024/1024,2) - round((b.num_rows*b.avg_row_len/1024/1024),2) "reclamable (Mb)",
round(((round(a.bytes/1024/1024,2) - round((b.num_rows*b.avg_row_len/1024/1024),2))/round(a.bytes/1024/1024,2))*100,2)"% reclamable", 
round(b.initial_extent/1024,2) "initial_extent (Kb)",b.pct_free
from dba_segments a, dba_tab_subpartitions b
where a.segment_name = b.table_name
and a.partition_name = b.subpartition_name
and a.owner = b.table_owner
and a.segment_type = 'TABLE SUBPARTITION'
and a.owner like upper ('&v_fr_owner')
and a.segment_name like upper ('&v_fr_table')
and a.partition_name like upper ('&v_fr_subpartition')
order by a.owner,a.segment_name,a.partition_name asc;