0

金利の価格などを把握する手順を作成しようとしています。ここに少し抜粋があります。

ただし、「call due_form( in amtDue double, in extPrice double 」付近の構文を確認してください」というエラーが表示されます。

変数は正しいスコープにありませんか? 問題は何ですか?任意の提案をいただければ幸いです。

    create procedure due_form(in amtDue double
                            , in extPrice double
                            , in discAmt double
                            , in discPrice double
                            , in p_taxRate double
                            , out   p_msg   varchar(255))
    begin
        set p_msg := concat(
    'Amount Due         ' , amtDue , '\n'
    , 'Ext Price        ', extPrice, '\n'
    , 'Disc Amount      ', discAmt, '\n'
    , 'After Discount   ', discPrice, '\n'
    , 'Sales Tax        ', p_taxRate);

    end;
    #
    create procedure due( in p_price double
                        , in p_quantity integer
                        , in p_discRate double
                        , in p_taxRate double
                        , in p_shipping double
                        , out p_amtDue  double
                        , out p_msg varchar(255) )
    begin
declare extPrice double;
declare discAmt double;
declare discPrice double;
declare amtDue double;
declare msg varchar(255);

select p_price, p_quantity, p_discRate, p_taxRate, p_shipping;

set extPrice := p_price * p_quantity;
set discAmt := extPrice *  p_discRate; 
set discPrice := extPrice - discAmt; 
set amtDue:= discPrice * p_taxRate + p_shipping;

set p_amtDue := amtDue;

set msg := call due_form( in amtDue double
                                    , in extPrice double
                                    , in discAmt double
                                    , in discPrice double
                                    , in p_taxRate double
                                    , out p_msg varchar(255) )

set p_msg := msg; 

select p_msg;

終わり;

4

1 に答える 1

0

プロシージャの結果を変数に割り当てることはできませんが、前にキーワードp_msgがあるため、戻り値が含まれます。 プロシージャを呼び出すときは、各パラメータのタイプを使用したり、繰り返したりしないでください。手順はすでに定義されています。out
in/out

select p_price, p_quantity, p_discRate, p_taxRate, p_shipping;

set extPrice := p_price * p_quantity;
set discAmt := extPrice *  p_discRate; 
set discPrice := extPrice - discAmt; 
set amtDue:= discPrice * p_taxRate + p_shipping;

set p_amtDue := amtDue;

call due_form(amtDue, extPrice, discAmt, discPrice, p_taxRate, p_msg );

select p_msg;
于 2012-09-13T00:02:08.993 に答える