groplo
groplo

Reputation: 3

Issue with stored procedure execution SQL Oracle

I’m trying to create a stored procedure in Oracle apex that execute 4 other procedures that work by themselves alone, but it looks like I'm doing something wrong. And I don't really know what to change, could someone please help me?

create or replace procedure "UPDATE_COST"
is
begin
UPDATE orders
    SET order_price = (
        SELECT sum(total) 
        FROM detail_order 
        where detail_order.nord=orders.nord
        group by nord
    );
end;

create or replace procedure "Detail_quantity_proc"
is
begin
update detail_order d set
  d.total = (select d.quantity * p.price_exclvat
             from product p
             where p.npro = d.npro
            )
where exists (select null from product a
              where a.npro = d.npro
             );
end;

create or replace procedure "Proc_excl_vat"
is
begin
UPDATE bill
    SET PRICE_EXCL_VAT = (
        SELECT ORDER_PRICE 
        FROM orders 
        where orders.nord=bill.nord
    );
end;

create or replace procedure "Proc_INCL"
is
begin
UPDATE BILL SET PRICE_INCL_VAT = PRICE_EXCL_VAT*1.06;
end;

create or replace procedure "Fill_all_cost"
is
begin
execute UPDATE_COST;
execute Detail_quantity_proc;
execute Proc_excl_vat;
execute Proc_INCL;
end;

Upvotes: 0

Views: 63

Answers (1)

eaolson
eaolson

Reputation: 15094

You don't need the execute keyword. Also, you have those defined with double quotes, so they are case sensitive. Redefine them without the quotes:

create or replace procedure fill_all_costs
is
begin
    update_cost;
    detail_quantity_proc;
    proc_excl_vat;
    proc_incl;
end;

Upvotes: 1

Related Questions