title: a while loop in oracle
body: <p>Hi I wrote a while loop in Oracle SQL. I think the syntax is good, but it cannot be excute for some reason. Can someone help me to check where the problems is? Many thanks!</p>
  
  <p>It only uses one table "test_fruit", with colume "price". </p>
  
  <pre><code>BEGIN
    WHILE (select sum(price) from test_fruit) &lt;50 LOOP
      update test_fruit set price = price + 5; 
      EXIT WHEN (select max(price) from test_fruit) &gt;20; 
    END LOOP;
  END;
  </code></pre>
  
  <p>By the way, What I am trying to do is to update table, and increase the price of each row, until the sum is 50. Also max price in each row cannot exceed 20. thanks!</p>