-- change_price.sql

CREATE OR REPLACE PROCEDURE change_price
   (p_id product.product_id%TYPE, new_price product.price%TYPE)
AS
   old_price product.price%TYPE;
BEGIN
   SELECT price INTO old_price
     FROM product
    WHERE product_id = p_id;
   IF ABS(new_price - old_price) < (old_price * 0.2) THEN
      UPDATE product
         SET price = new_price
       WHERE product_id = p_id;
   END IF;
END;
/