undefine TABLE
undefine OWNER
SELECT ob.owner, ob.object_name, ob.subobject_name, ob.object_type, rowcnt, avgrln ,samplesize, analyzetime
FROM sys.WRI$_OPTSTAT_TAB_HISTORY, dba_objects ob
WHERE owner=upper('&&OWNER')
and object_name=upper('&&TABLE')
and object_type like ('TABLE%')
and object_id=obj#
union
select owner, table_name, null, 'TABLE', num_rows, AVG_ROW_LEN, SAMPLE_SIZE, last_analyzed
  from dba_tables where owner=upper('&&OWNER') and table_name=upper('&&TABLE')
union
select table_owner, table_name, partition_name, 'TABLE PARTITION', num_rows, AVG_ROW_LEN, SAMPLE_SIZE, last_analyzed
  from dba_tab_partitions where table_owner=upper('&&OWNER') and table_name=upper('&&TABLE')
order by 8
/
