insert into metadata_statistics(rundate, metadata_defn, order_sequence, total_entries, metadata_id) 
select to_date(sysdate,'YYYY-MM-DD-HH24:MI:SS'), 'DataSizePerItem', rownum, totals, id from 
(select itd_item_id id,
length(itd_blob) as totals
from itd 
where  itd_company_id = 40001
and itd_next_version_id = 999999999
and itd_blob is not null
order by totals desc
) ;
commit;
quit;
