Select * From tableA t, (Select 1 From all_objects Where rownum <= (Select quantity From tableA t Where Name = 'XXX')) t2 Where Name = 'XXX';