select col1,col2,type
from (select col1,col2,type,rn,max() over(partitio by type) as rn_max
from (select col1,col2,type,row_number() over (paritition by type order by dbms_random.value) as rn
from tablename ) t
) p
where rn/rn_max<=0.1
;
sample不确定能不能用分析函数,但是主要是用来全表取sample的
select * from t1 sample(10) where 类型=‘’
union
select * from t1 sample(10) where 类型=‘’
...
几个类型分开取试试。