SET SERVEROUTPUT ON
SET VERIFY OFF

DECLARE
v_object_owner           VARCHAR2(30) := UPPER('&1');
   v_object_name              VARCHAR2(30)  := UPPER('&2');
   v_object_type              VARCHAR2(30)  := UPPER('&3');
   v_partition_name           VARCHAR2(30) DEFAULT NULL;
   v_start_time                TIMESTAMP DEFAULT NULL;
   v_end_time                 TIMESTAMP DEFAULT NULL;
   v_interval                 DSINTERVAL_UNCONSTRAINED DEFAULT NULL;
   v_skip_interpolated       VARCHAR2(30) DEFAULT 'FALSE';
   v_timeout_seconds          NUMBER(20,0) DEFAULT NULL;
   v_single_datapoint_flag    VARCHAR2(30) DEFAULT 'TRUE';
	v_timepoint TIMESTAMP;
   v_space_usage NUMBER(40,0),
   v_space_alloc NUMBER(40,0),
   v_quality VARCHAR(100);

DBMS_SPACE.OBJECT_GROWTH_TREND (
   object_owner =>v_ object_owner          ,
   object_name       =>v_object_name                 ,
   object_type       => v_ object_type     ,
   partition_name => v_partition_name         ,
   start_time => v_start_time             ,
   end_time  => v_end_time              ,
   interval => v_intercal              ,
   skip_interpolated => v_skip_interpolated     ,
   timeout_seconds => v_timeout_seconds     ,
   single_datapoint_flag => v_single_datapoint_flag) ;

RETURN object_growth_trend_table PIPELINED; 

DBMS_OUTPUT.PUT_LINE('object_name                    :' || v_object_name );
DBMS_OUTPUT.PUT_LINE('object_type                    :' || v_object_type);
DBMS_OUTPUT.PUT_LINE('object_owner             :' || v_object_owner);
DBMS_OUTPUT.PUT_LINE('start time             :' || v_start_time );
DBMS_OUTPUT.PUT_LINE('end_time             :' || v_end_time );
DBMS_OUTPUT.PUT_LINE('The time at which the statistic was recorded             :' || v_timepoint);
DBMS_OUTPUT.PUT_LINE('The space used by data             :' || v_space_usage);
DBMS_OUTPUT.PUT_LINE('The size of segment including overhead and unused space            :' || v_space_alloc);

TYPE object_growth_trend_row IS RECORD(
  timepoint TIMESTAMP,
  space_usage NUMBER,
  space_alloc NUMBER,
  quality VARCHAR(20));

END;
/