I don't know how to execute or test this procedure. I'm new in that area. Thanks in advance.
Table Prices has id,price, datePrice and productId. Table Products has id, currentprice and name
create or replace PROCEDURE "currentprice"
(idproduct IN NUMBER) AS
currentprice products.current_price%type;
BEGIN
SELECT price INTO currentprice
FROM prices
WHERE productId=idprice AND datePrice=(select max(datePrice) FROM prices WHERE
productId=idprice AND datePrice<=SYSDATE);
UPDATE products
SET currentprice = currentprice
WHERE id=idproduct;
END;
ORA,PLSorSP2. How did you call it exactly, and what was the whole error message? The query ofpricesmight fail withno data foundif there was no price stored for the specifiedidproduct(orproductId- was that a typo?)