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!
It only uses one table "test_fruit", with colume "price".
BEGIN
WHILE (select sum(price) from test_fruit) <50 LOOP
update test_fruit set price = price + 5;
EXIT WHEN (select max(price) from test_fruit) >20;
END LOOP;
END;
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!