I am writing the following code in plsql oracle to update the rating of seller and product as avg rating as given in order_products table:
create or replace procedure update_seller_product
as
begin
update product set rating=
(select rating from
(select p_id,avg(rating) as rating
from order_products
group by p_id
) as t2
)
where product.p_id=t2.p_id;
commit;
end;
/
but it is giving following error:
Statement ignored Error at line 4: PL/SQL: ORA-00907: missing right parenthesis
Why? Please help