DECLARE
  CURSOR c_t2 is select * from t2;
BEGIN
  FOR i in c_t2 LOOP
    insert into t3(total,orgid,trade)
         select total,orgid,trade 
           from (select * from t1 
                  where trade= i.trade 
                  order by total)
          where rownum <=i.num;
  END LOOP;
END;