1. 程式人生 > >MySQL 儲存過程相互呼叫舉例

MySQL 儲存過程相互呼叫舉例

create procedure prccharges(in orderno char(6),out shippingCharges float(4,2),out wrapCharges float(4,2))
   begin
    select mshippingcharges into shippingCharges from orders where corderno = orderno;
    select mgiftwrapcharges into wrapcharges from orders where corderno = orderno;
   end;
create procedure prcHandLingCharges(in orderno char(6),out handlingCharges float(4,2))
   begin
    declare ppp float(4,2);
    declare qqq float(4,2);
    call prccharges(no,p,q); 
    set handlingCharges = p+ q;
   end;



上面的例子呼叫方法
call prcHandLingCharges('1',@af);
select @af;